mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.2.2887: crash when passing null string to fullcommand()
Problem: Crash when passing null string to fullcommand().
Solution: Check for NULL pointer. (closes vim/vim#8256)
4c8e8c6e19
This commit is contained in:
parent
f65b0d4236
commit
6e1a59da6c
@ -2891,13 +2891,17 @@ void f_fullcommand(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
exarg_T ea;
|
||||
char_u *name = argvars[0].vval.v_string;
|
||||
|
||||
while (name[0] != NUL && name[0] == ':') {
|
||||
rettv->v_type = VAR_STRING;
|
||||
rettv->vval.v_string = NULL;
|
||||
if (name == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
while (*name != NUL && *name == ':') {
|
||||
name++;
|
||||
}
|
||||
name = skip_range(name, NULL);
|
||||
|
||||
rettv->v_type = VAR_STRING;
|
||||
|
||||
ea.cmd = (*name == '2' || *name == '3') ? name + 1 : name;
|
||||
ea.cmdidx = (cmdidx_T)0;
|
||||
char_u *p = find_command(&ea, NULL);
|
||||
|
@ -500,6 +500,7 @@ func Test_fullcommand()
|
||||
for [in, want] in items(tests)
|
||||
call assert_equal(want, fullcommand(in))
|
||||
endfor
|
||||
call assert_equal('', fullcommand(v:_null_string))
|
||||
|
||||
call assert_equal('syntax', 'syn'->fullcommand())
|
||||
endfunc
|
||||
|
Loading…
Reference in New Issue
Block a user