Skip to content

Commit

Permalink
patch 8.2.4074: going over the end of NameBuff
Browse files Browse the repository at this point in the history
Problem:    Going over the end of NameBuff.
Solution:   Check length when appending a space.
  • Loading branch information
brammool committed Jan 13, 2022
1 parent 5459806 commit de05bb2
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/drawscreen.c
Expand Up @@ -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))
{
Expand Down
15 changes: 15 additions & 0 deletions src/testdir/test_edit.vim
Expand Up @@ -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
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -750,6 +750,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
4074,
/**/
4073,
/**/
Expand Down

0 comments on commit de05bb2

Please sign in to comment.