# HG changeset patch # User Bram Moolenaar # Date 1655291703 -7200 # Node ID 4d72bdf70625587f1ad5aaf541031155cb2bbb19 # Parent e01302a9d6c834ae37ff289c7d9120bcb39b80b0 patch 8.2.5097: using uninitialized memory when using 'listchars' Commit: https://github.com/vim/vim/commit/74ac29cecd56457ee93f3f71b31b7a2e6d9712d6 Author: Bram Moolenaar 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) diff --git a/src/message.c b/src/message.c --- 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 { diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -735,6 +735,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 5097, +/**/ 5096, /**/ 5095,