diff src/libvterm/src/vterm.c @ 15166:694594a0d25d v8.1.0593

patch 8.1.0593: illegal memory access in libvterm test commit https://github.com/vim/vim/commit/37e3edce200c5a0ae8f81ca729b18d75477d2725 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Dec 15 14:49:34 2018 +0100 patch 8.1.0593: illegal memory access in libvterm test Problem: Illegal memory access in libvterm test. Solution: Fix off-by-one error.
author Bram Moolenaar <Bram@vim.org>
date Sat, 15 Dec 2018 15:00:07 +0100
parents 2449b6ce1456
children 544490b69e1d
line wrap: on
line diff
--- a/src/libvterm/src/vterm.c
+++ b/src/libvterm/src/vterm.c
@@ -169,9 +169,9 @@ INTERNAL void vterm_push_output_vsprintf
 #else
   written = vsprintf(buffer, format, args);
 
-  if(written >= (int)(vt->outbuffer_len - vt->outbuffer_cur)) {
+  if(written >= (int)(vt->outbuffer_len - vt->outbuffer_cur - 1)) {
     /* output was truncated */
-    written = vt->outbuffer_len - vt->outbuffer_cur;
+    written = vt->outbuffer_len - vt->outbuffer_cur - 1;
   }
   if (written > 0)
   {