diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-09-02 19:53:07 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-09-02 19:53:07 +0200 |
commit | 87e1587b8add93e40340170e4261cdadc4c8940e (patch) | |
tree | 9d5094cbba01c59d0b0c229300fa87a0fff82241 /src/evalfunc.c | |
parent | 26a4484da20039b61f18d3565a4b4339c4d1f7e3 (diff) |
patch 8.2.3396: when libcall() fails invalid pointer may be usedv8.2.3396
Problem: When libcall() fails invalid pointer may be used.
Solution: Initialize the string to NULL. (Yasuhiro Matsumoto, closes #8829)
Diffstat (limited to 'src/evalfunc.c')
-rw-r--r-- | src/evalfunc.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c index 287ca3c3ff..fd385fea37 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -6689,9 +6689,14 @@ libcall_common(typval_T *argvars UNUSED, typval_T *rettv, int type) if (argvars[2].v_type == VAR_STRING) string_in = argvars[2].vval.v_string; if (type == VAR_NUMBER) + { string_result = NULL; + } else + { + rettv->vval.v_string = NULL; string_result = &rettv->vval.v_string; + } if (mch_libcall(argvars[0].vval.v_string, argvars[1].vval.v_string, string_in, |