summaryrefslogtreecommitdiffstats
path: root/src/channel.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-04-07 13:22:21 +0200
committerBram Moolenaar <Bram@vim.org>2018-04-07 13:22:21 +0200
commit22efba47deb7e504142487fdc1617ec638cf0683 (patch)
tree0b7a6e98661786974cd0137b2c5ce99a03dc3120 /src/channel.c
parentb6ed74fef8e088128c45928ee7d02458b2882c1e (diff)
patch 8.0.1671: crash when passing non-dict argument as env to job_start()v8.0.1671
Problem: Crash when passing non-dict argument as env to job_start(). Solution: Check for valid argument. (Ozaki Kiichi, closes #2765)
Diffstat (limited to 'src/channel.c')
-rw-r--r--src/channel.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/channel.c b/src/channel.c
index 38e639224c..581c6f603f 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -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)
{