0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

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 #10576)
This commit is contained in:
Bram Moolenaar
2022-06-15 12:12:44 +01:00
parent 377d92a912
commit 74ac29cecd
2 changed files with 5 additions and 2 deletions

View File

@@ -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
{