0
0
mirror of https://github.com/vim/vim.git synced 2025-11-15 23:14:06 -05:00

patch 8.0.1671: crash when passing non-dict argument as env to job_start()

Problem:    Crash when passing non-dict argument as env to job_start().
Solution:   Check for valid argument. (Ozaki Kiichi, closes #2765)
This commit is contained in:
Bram Moolenaar
2018-04-07 13:22:21 +02:00
parent b6ed74fef8
commit 22efba47de
3 changed files with 16 additions and 5 deletions

View File

@@ -4797,9 +4797,15 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
{
if (!(supported2 & JO2_ENV))
break;
if (item->v_type != VAR_DICT)
{
EMSG2(_(e_invargval), "env");
return FAIL;
}
opt->jo_set2 |= JO2_ENV;
opt->jo_env = item->vval.v_dict;
++item->vval.v_dict->dv_refcount;
if (opt->jo_env != NULL)
++opt->jo_env->dv_refcount;
}
else if (STRCMP(hi->hi_key, "cwd") == 0)
{