]> granicus.if.org Git - vim/commitdiff
patch 8.2.4074: going over the end of NameBuff v8.2.4074
authorBram Moolenaar <Bram@vim.org>
Thu, 13 Jan 2022 13:08:14 +0000 (13:08 +0000)
committerBram Moolenaar <Bram@vim.org>
Thu, 13 Jan 2022 13:08:14 +0000 (13:08 +0000)
Problem:    Going over the end of NameBuff.
Solution:   Check length when appending a space.

src/drawscreen.c
src/testdir/test_edit.vim
src/version.c

index 28a2072959fed176a9702e1649668821cf99e523..453ca91c33adb8715bcfb52a6e591db2dbb04a3c 100644 (file)
@@ -462,12 +462,13 @@ win_redr_status(win_T *wp, int ignore_pum UNUSED)
        p = NameBuff;
        len = (int)STRLEN(p);
 
-       if (bt_help(wp->w_buffer)
+       if ((bt_help(wp->w_buffer)
 #ifdef FEAT_QUICKFIX
-               || wp->w_p_pvw
+                   || wp->w_p_pvw
 #endif
-               || bufIsChanged(wp->w_buffer)
-               || wp->w_buffer->b_p_ro)
+                   || bufIsChanged(wp->w_buffer)
+                   || wp->w_buffer->b_p_ro)
+               && len < MAXPATHL - 1)
            *(p + len++) = ' ';
        if (bt_help(wp->w_buffer))
        {
index e83d67250c26bf3ab899deadd8087f0b0b9d409b..63226466ee9bc7c54fd95e52429af1921a3fc38f 100644 (file)
@@ -2103,5 +2103,20 @@ func Test_edit_CTRL_hat()
   bwipe!
 endfunc
 
+" Weird long file name was going over the end of NameBuff
+func Test_edit_overlong_file_name()
+  CheckUnix
+
+  file 0000000000000000000000000000
+  file %%%%%%%%%%%%%%%%%%%%%%%%%%
+  file %%%%%%
+  set readonly
+  set ls=2 
+
+  redraw!
+  set noreadonly ls&
+  bwipe!
+endfunc
+
 
 " vim: shiftwidth=2 sts=2 expandtab
index 1b37a5d50abd5f6ee0c22640e171db454c38f9f5..1f4a031622401c3746282f5952cfad8d9abfdabf 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4074,
 /**/
     4073,
 /**/