]> granicus.if.org Git - vim/commitdiff
patch 8.2.1088: a very long translation might cause a buffer overflow v8.2.1088
authorBram Moolenaar <Bram@vim.org>
Mon, 29 Jun 2020 19:32:06 +0000 (21:32 +0200)
committerBram Moolenaar <Bram@vim.org>
Mon, 29 Jun 2020 19:32:06 +0000 (21:32 +0200)
Problem:    A very long translation might cause a buffer overflow.
Solution:   Trunctate the message if needed.

src/fileio.c
src/version.c

index 395e54b6a44dc3b097b545481115ff0410fd9418..81a502665252664cf7b70b13e5d21599cc539470 100644 (file)
@@ -52,10 +52,14 @@ filemess(
     if (msg_silent != 0)
        return;
     msg_add_fname(buf, name);      // put file name in IObuff with quotes
+
     // If it's extremely long, truncate it.
-    if (STRLEN(IObuff) > IOSIZE - 80)
-       IObuff[IOSIZE - 80] = NUL;
-    STRCAT(IObuff, s);
+    if (STRLEN(IObuff) > IOSIZE - 100)
+       IObuff[IOSIZE - 100] = NUL;
+
+    // Avoid an over-long translation to cause trouble.
+    STRNCAT(IObuff, s, 99);
+
     /*
      * For the first message may have to start a new line.
      * For further ones overwrite the previous one, reset msg_scroll before
index f38c978b2cd35b1d4d3b924d77d23cf31e89ed12..48ff321cab0e40dbb1ce1fde9d0e56ab6ef317be 100644 (file)
@@ -754,6 +754,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1088,
 /**/
     1087,
 /**/