diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-06-16 07:18:27 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-16 07:18:27 +0800 |
commit | 4cc05a75ea9e67099e8a54311390af299c4f462e (patch) | |
tree | 87fd5c125148b652db70e1b2d9ddc0767d34d4c5 | |
parent | 0c6ad03c3f89c2ff26dfd2f2e861cf3ed09f6c87 (diff) | |
download | rneovim-4cc05a75ea9e67099e8a54311390af299c4f462e.tar.gz rneovim-4cc05a75ea9e67099e8a54311390af299c4f462e.tar.bz2 rneovim-4cc05a75ea9e67099e8a54311390af299c4f462e.zip |
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)
https://github.com/vim/vim/commit/74ac29cecd56457ee93f3f71b31b7a2e6d9712d6
-rw-r--r-- | src/nvim/message.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nvim/message.c b/src/nvim/message.c index 182f8494a1..4ae11ee135 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -1851,8 +1851,8 @@ void msg_prt_line(char_u *s, int list) } else if (curwin->w_p_lcs_chars.nbsp != NUL && list && (utf_ptr2char((char *)s) == 160 || utf_ptr2char((char *)s) == 0x202f)) { - utf_char2bytes(curwin->w_p_lcs_chars.nbsp, buf); - buf[utfc_ptr2len(buf)] = NUL; + int len = utf_char2bytes(curwin->w_p_lcs_chars.nbsp, buf); + buf[len] = NUL; } else { memmove(buf, s, (size_t)l); buf[l] = NUL; |