diff src/message.c @ 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 d8a962d7b008
children d9acbf59032c
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
 	    {