1
0
forked from aniani/vim

patch 8.2.1945: crash when passing NULL function to reduce()

Problem:    Crash when passing NULL function to reduce().
Solution:   Check for NULL pointer and give an error. (Dominique Pellé,
            closes #7243)
This commit is contained in:
Bram Moolenaar
2020-11-03 18:20:19 +01:00
parent 6fd3a4ba23
commit 0d90e728fe
4 changed files with 12 additions and 2 deletions

View File

@@ -2552,8 +2552,11 @@ f_reduce(typval_T *argvars, typval_T *rettv)
}
else
func_name = tv_get_string(&argvars[1]);
if (*func_name == NUL)
return; // type error or empty name
if (func_name == NULL || *func_name == NUL)
{
emsg(_(e_missing_function_argument));
return;
}
vim_memset(&funcexe, 0, sizeof(funcexe));
funcexe.evaluate = TRUE;