diff src/userfunc.c @ 28267:39a833e69bf3 v8.2.4659

patch 8.2.4659: invalid memory access when using printable function name Commit: https://github.com/vim/vim/commit/96e08e028cbcda23dccf83de6b71b3c6bf1f9d4a Author: Bram Moolenaar <Bram@vim.org> Date: Thu Mar 31 21:40:33 2022 +0100 patch 8.2.4659: invalid memory access when using printable function name Problem: Invalid memory access when using printable function name. Solution: Adjust copied name length.
author Bram Moolenaar <Bram@vim.org>
date Thu, 31 Mar 2022 22:45:03 +0200
parents c446812efd60
children b418e073b42f
line wrap: on
line diff
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -543,7 +543,7 @@ make_ufunc_name_readable(char_u *name, c
     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;
 }