]> granicus.if.org Git - vim/commitdiff
patch 8.2.4659: invalid memory access when using printable function name v8.2.4659
authorBram Moolenaar <Bram@vim.org>
Thu, 31 Mar 2022 20:40:33 +0000 (21:40 +0100)
committerBram Moolenaar <Bram@vim.org>
Thu, 31 Mar 2022 20:40:33 +0000 (21:40 +0100)
Problem:    Invalid memory access when using printable function name.
Solution:   Adjust copied name length.

src/userfunc.c
src/version.c

index ffc67eab40dfc841a013980a127cbe49200a5646..052923e94c910db866497350106381ade8c4d00f 100644 (file)
@@ -543,7 +543,7 @@ make_ufunc_name_readable(char_u *name, char_u *buf, size_t bufsize)
     if (len + 3 > bufsize)
        return name;
 
-    mch_memmove(buf + 5, name + 3, len + 1);
+    mch_memmove(buf + 5, name + 3, len - 2);  // Include trailing NUL
     mch_memmove(buf, "<SNR>", 5);
     return buf;
 }
index f0240d244efb88713b779a35289a68f6cd5fcb5c..c6f444696a70682d53fc1db0fb281bd8a217053d 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4659,
 /**/
     4658,
 /**/