mirror of
https://github.com/neovim/neovim.git
synced 2025-09-24 12:08:33 +00:00
vim-patch:8.2.5097: using uninitialized memory when using 'listchars' (#18974)
Problem: Using uninitialized memory when using 'listchars'.
Solution: Use the length returned by mb_char2bytes(). (closes vim/vim#10576)
74ac29cecd
This commit is contained in:
@@ -1851,8 +1851,8 @@ void msg_prt_line(char_u *s, int list)
|
|||||||
} else if (curwin->w_p_lcs_chars.nbsp != NUL && list
|
} else if (curwin->w_p_lcs_chars.nbsp != NUL && list
|
||||||
&& (utf_ptr2char((char *)s) == 160
|
&& (utf_ptr2char((char *)s) == 160
|
||||||
|| utf_ptr2char((char *)s) == 0x202f)) {
|
|| utf_ptr2char((char *)s) == 0x202f)) {
|
||||||
utf_char2bytes(curwin->w_p_lcs_chars.nbsp, buf);
|
int len = utf_char2bytes(curwin->w_p_lcs_chars.nbsp, buf);
|
||||||
buf[utfc_ptr2len(buf)] = NUL;
|
buf[len] = NUL;
|
||||||
} else {
|
} else {
|
||||||
memmove(buf, s, (size_t)l);
|
memmove(buf, s, (size_t)l);
|
||||||
buf[l] = NUL;
|
buf[l] = NUL;
|
||||||
|
Reference in New Issue
Block a user