changeset 22724:51bc501a13ca v8.2.1910

patch 8.2.1910: reading past the end of the command line Commit: https://github.com/vim/vim/commit/caf73dcfade0a435ea3f989285b43f07c40c9948 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Oct 26 21:39:13 2020 +0100 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 https://github.com/vim/vim/issues/7204)
author Bram Moolenaar <Bram@vim.org>
date Mon, 26 Oct 2020 21:45:04 +0100
parents 5b7ea82bc18f
children 4f40cc0fea4c
files src/ex_docmd.c src/testdir/test_edit.vim src/version.c
diffstat 3 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -2958,8 +2958,7 @@ undo_cmdmod(cmdmod_T *cmod)
 	cmod->cmod_save_ei = NULL;
     }
 
-    if (cmod->cmod_filter_regmatch.regprog != NULL)
-	vim_regfree(cmod->cmod_filter_regmatch.regprog);
+    vim_regfree(cmod->cmod_filter_regmatch.regprog);
 
     if (cmod->cmod_save_msg_silent > 0)
     {
@@ -4696,6 +4695,8 @@ separate_nextcmd(exarg_T *eap)
 	{
 	    p += 2;
 	    (void)skip_expr(&p, NULL);
+	    if (*p == NUL)		// stop at NUL after CTRL-V
+		break;
 	}
 #endif
 
--- a/src/testdir/test_edit.vim
+++ b/src/testdir/test_edit.vim
@@ -1832,4 +1832,11 @@ func Test_edit_browse()
   bwipe!
 endfunc
 
+func Test_read_invalid()
+  set encoding=latin1
+  " This was not properly checking for going past the end.
+  call assert_fails('r`=', 'E484')
+  set encoding=utf-8
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1910,
+/**/
     1909,
 /**/
     1908,