Skip to content

Commit caf73dc

Browse files
committed
patch 8.2.1910: reading past the end of the command line
Problem: Reading past the end of the command line. Solution: Check for NUL. (closes #7204)
1 parent cb80aa2 commit caf73dc

3 files changed

Lines changed: 12 additions & 2 deletions

File tree

src/ex_docmd.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2958,8 +2958,7 @@ undo_cmdmod(cmdmod_T *cmod)
29582958
cmod->cmod_save_ei = NULL;
29592959
}
29602960

2961-
if (cmod->cmod_filter_regmatch.regprog != NULL)
2962-
vim_regfree(cmod->cmod_filter_regmatch.regprog);
2961+
vim_regfree(cmod->cmod_filter_regmatch.regprog);
29632962

29642963
if (cmod->cmod_save_msg_silent > 0)
29652964
{
@@ -4696,6 +4695,8 @@ separate_nextcmd(exarg_T *eap)
46964695
{
46974696
p += 2;
46984697
(void)skip_expr(&p, NULL);
4698+
if (*p == NUL) // stop at NUL after CTRL-V
4699+
break;
46994700
}
47004701
#endif
47014702

src/testdir/test_edit.vim

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1832,4 +1832,11 @@ func Test_edit_browse()
18321832
bwipe!
18331833
endfunc
18341834

1835+
func Test_read_invalid()
1836+
set encoding=latin1
1837+
" This was not properly checking for going past the end.
1838+
call assert_fails('r`=', 'E484')
1839+
set encoding=utf-8
1840+
endfunc
1841+
18351842
" vim: shiftwidth=2 sts=2 expandtab

src/version.c

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

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
1910,
753755
/**/
754756
1909,
755757
/**/

0 commit comments

Comments
 (0)