]> granicus.if.org Git - vim/commitdiff
patch 8.2.5097: using uninitialized memory when using 'listchars' v8.2.5097
authorBram Moolenaar <Bram@vim.org>
Wed, 15 Jun 2022 11:12:44 +0000 (12:12 +0100)
committerBram Moolenaar <Bram@vim.org>
Wed, 15 Jun 2022 11:12:44 +0000 (12:12 +0100)
Problem:    Using uninitialized memory when using 'listchars'.
Solution:   Use the length returned by mb_char2bytes(). (closes #10576)

src/message.c
src/version.c

index 3c9e4a0119d2af1168a6a2635795b0a965193bc3..07566da9491be10e5604f43e73f95c95173cb370 100644 (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
            {
index 3ee54db42bc2affd228c64d92beac8a7a06896ed..4d63c86563851624df42b8cb07adbe42c7147438 100644 (file)
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    5097,
 /**/
     5096,
 /**/