comparison 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
comparison
equal deleted inserted replaced
28266:0b12ce9ae38f 28267:39a833e69bf3
541 return name; 541 return name;
542 len = STRLEN(name); 542 len = STRLEN(name);
543 if (len + 3 > bufsize) 543 if (len + 3 > bufsize)
544 return name; 544 return name;
545 545
546 mch_memmove(buf + 5, name + 3, len + 1); 546 mch_memmove(buf + 5, name + 3, len - 2); // Include trailing NUL
547 mch_memmove(buf, "<SNR>", 5); 547 mch_memmove(buf, "<SNR>", 5);
548 return buf; 548 return buf;
549 } 549 }
550 550
551 /* 551 /*