changeset 29155:4d72bdf70625 v8.2.5097

patch 8.2.5097: using uninitialized memory when using 'listchars' Commit: https://github.com/vim/vim/commit/74ac29cecd56457ee93f3f71b31b7a2e6d9712d6 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Jun 15 12:12:44 2022 +0100 patch 8.2.5097: using uninitialized memory when using 'listchars' Problem: Using uninitialized memory when using 'listchars'. Solution: Use the length returned by mb_char2bytes(). (closes https://github.com/vim/vim/issues/10576)
author Bram Moolenaar <Bram@vim.org>
date Wed, 15 Jun 2022 13:15:03 +0200
parents e01302a9d6c8
children b4839a29996e
files src/message.c src/version.c
diffstat 2 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/message.c
+++ b/src/message.c
@@ -1920,8 +1920,9 @@ msg_prt_line(char_u *s, int list)
 		    && (mb_ptr2char(s) == 160
 			|| mb_ptr2char(s) == 0x202f))
 	    {
-		mb_char2bytes(curwin->w_lcs_chars.nbsp, buf);
-		buf[(*mb_ptr2len)(buf)] = NUL;
+		int len = mb_char2bytes(curwin->w_lcs_chars.nbsp, buf);
+
+		buf[len] = NUL;
 	    }
 	    else
 	    {
--- a/src/version.c
+++ b/src/version.c
@@ -735,6 +735,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    5097,
+/**/
     5096,
 /**/
     5095,