changeset 33128:b2c506f480c7 v9.0.1846

patch 9.0.1846: [security] crash in fullcommand Commit: https://github.com/vim/vim/commit/4c6fe2e2ea62469642ed1d80b16d39e616b25cf5 Author: Christian Brabandt <cb@256bit.org> Date: Sat Sep 2 19:30:03 2023 +0200 patch 9.0.1846: [security] crash in fullcommand Problem: crash in fullcommand Solution: Check for typeval correctly Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Sat, 02 Sep 2023 19:45:03 +0200
parents 95f1fc935927
children 93e2f3574adb
files src/ex_docmd.c src/testdir/test_functions.vim src/version.c
diffstat 3 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -4087,7 +4087,7 @@ f_fullcommand(typval_T *argvars, typval_
 		|| check_for_opt_bool_arg(argvars, 1) == FAIL))
 	return;
 
-    name = argvars[0].vval.v_string;
+    name = tv_get_string(&argvars[0]);
     if (name == NULL)
 	return;
 
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -3607,4 +3607,9 @@ func Test_string_reverse()
   let &encoding = save_enc
 endfunc
 
+func Test_fullcommand()
+  " this used to crash vim
+  call assert_equal('', fullcommand(10))
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
--- a/src/version.c
+++ b/src/version.c
@@ -700,6 +700,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1846,
+/**/
     1845,
 /**/
     1844,