mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 11:28:22 +00:00
vim-patch:9.0.1846: [security] crash in fullcommand
Problem: crash in fullcommand
Solution: Check for typeval correctly
4c6fe2e2ea
Co-authored-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
@@ -3136,7 +3136,7 @@ int cmd_exists(const char *const name)
|
|||||||
/// "fullcommand" function
|
/// "fullcommand" function
|
||||||
void f_fullcommand(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
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->v_type = VAR_STRING;
|
||||||
rettv->vval.v_string = NULL;
|
rettv->vval.v_string = NULL;
|
||||||
|
@@ -3273,4 +3273,9 @@ func Test_string_reverse()
|
|||||||
let &encoding = save_enc
|
let &encoding = save_enc
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_fullcommand()
|
||||||
|
" this used to crash vim
|
||||||
|
call assert_equal('', fullcommand(10))
|
||||||
|
endfunc
|
||||||
|
|
||||||
" vim: shiftwidth=2 sts=2 expandtab
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
Reference in New Issue
Block a user