vim-patch:8.2.1773: crash when calling mapset() with a list as first argument

Problem:    Crash when calling mapset() with a list as first argument.
Solution:   Check for NULL. (closes vim/vim#7040)
1b9129809d
This commit is contained in:
zeertzjq
2022-08-01 15:42:01 +08:00
parent 6963c2bdcd
commit 7d45f1a5e8
2 changed files with 7 additions and 2 deletions

View File

@@ -2132,8 +2132,11 @@ void f_mapset(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{
char buf[NUMBUFLEN];
const char *which = tv_get_string_buf_chk(&argvars[0], buf);
int mode = get_map_mode((char **)&which, 0);
bool is_abbr = tv_get_number(&argvars[1]) != 0;
if (which == NULL) {
return;
}
const int mode = get_map_mode((char **)&which, 0);
const bool is_abbr = tv_get_number(&argvars[1]) != 0;
if (argvars[2].v_type != VAR_DICT) {
emsg(_(e_dictreq));