diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-06-15 12:12:44 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-06-15 12:12:44 +0100 |
commit | 74ac29cecd56457ee93f3f71b31b7a2e6d9712d6 (patch) | |
tree | a76e393ca6777a1b7c940dff809f5f9f319a91ee /src/message.c | |
parent | 377d92a912d4d11a336322a6eeff128cf8ebb5fa (diff) |
patch 8.2.5097: using uninitialized memory when using 'listchars'v8.2.5097
Problem: Using uninitialized memory when using 'listchars'.
Solution: Use the length returned by mb_char2bytes(). (closes #10576)
Diffstat (limited to 'src/message.c')
-rw-r--r-- | src/message.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/message.c b/src/message.c index 3c9e4a0119..07566da949 100644 --- 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 { |