Skip to content

Commit 70dfc37

Browse files
basilisk0315chrisbra
authored andcommitted
patch 9.1.1021: string might be used without a trailing NUL
Problem: string might be used without a trailing NUL (after v9.1.0997) Solution: Make sure that the buffer is NUL terminated closes: #16457 Signed-off-by: John Marriott <[email protected]> Signed-off-by: Christian Brabandt <[email protected]>
1 parent 037b028 commit 70dfc37

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/drawscreen.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,10 @@ win_redr_status(win_T *wp, int ignore_pum UNUSED)
479479
|| bufIsChanged(wp->w_buffer)
480480
|| wp->w_buffer->b_p_ro)
481481
&& plen < MAXPATHL - 1)
482-
*(p + plen++) = ' ';
482+
{
483+
*(p + plen++) = ' '; // replace NUL with space
484+
*(p + plen) = NUL; // NUL terminate the string
485+
}
483486
if (bt_help(wp->w_buffer))
484487
plen += vim_snprintf((char *)p + plen, MAXPATHL - plen, "%s", _("[Help]"));
485488
#ifdef FEAT_QUICKFIX

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,8 @@ static char *(features[]) =
704704

705705
static int included_patches[] =
706706
{ /* Add new patch number below this line */
707+
/**/
708+
1021,
707709
/**/
708710
1020,
709711
/**/

0 commit comments

Comments
 (0)