aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-09-03 09:12:44 +0800
committerzeertzjq <zeertzjq@outlook.com>2023-09-03 09:14:30 +0800
commitb55010a539c37efcce10b08ee38df9dd4b4d9fb7 (patch)
treeaad4b845c6fe6634b0e07c0929b0bd443075b195
parent272c4fba8386ccc17706647c6b28fa70f43e1e66 (diff)
downloadrneovim-b55010a539c37efcce10b08ee38df9dd4b4d9fb7.tar.gz
rneovim-b55010a539c37efcce10b08ee38df9dd4b4d9fb7.tar.bz2
rneovim-b55010a539c37efcce10b08ee38df9dd4b4d9fb7.zip
vim-patch:9.0.1846: [security] crash in fullcommand
Problem: crash in fullcommand Solution: Check for typeval correctly https://github.com/vim/vim/commit/4c6fe2e2ea62469642ed1d80b16d39e616b25cf5 Co-authored-by: Christian Brabandt <cb@256bit.org>
-rw-r--r--src/nvim/ex_docmd.c2
-rw-r--r--test/old/testdir/test_functions.vim5
2 files changed, 6 insertions, 1 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 3ff1442640..44610c81d8 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -3136,7 +3136,7 @@ int cmd_exists(const char *const name)
/// "fullcommand" function
void f_fullcommand(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
{
- char *name = argvars[0].vval.v_string;
+ char *name = (char *)tv_get_string(&argvars[0]);
rettv->v_type = VAR_STRING;
rettv->vval.v_string = NULL;
diff --git a/test/old/testdir/test_functions.vim b/test/old/testdir/test_functions.vim
index 37541c4af3..eff4e36f34 100644
--- a/test/old/testdir/test_functions.vim
+++ b/test/old/testdir/test_functions.vim
@@ -3273,4 +3273,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