]> granicus.if.org Git - vim/commitdiff
patch 8.2.3396: when libcall() fails invalid pointer may be used v8.2.3396
authorBram Moolenaar <Bram@vim.org>
Thu, 2 Sep 2021 17:53:07 +0000 (19:53 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 2 Sep 2021 17:53:07 +0000 (19:53 +0200)
Problem:    When libcall() fails invalid pointer may be used.
Solution:   Initialize the string to NULL. (Yasuhiro Matsumoto, closes #8829)

src/evalfunc.c
src/version.c

index 287ca3c3ff322739d67a3ac0a5d1ba9d3a910115..fd385fea37744e8d3dd9cd1d558eec3fa8750de4 100644 (file)
@@ -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,
index 435affea7a7005105e24b61a6e86c9cb85f0e5c9..3708e8f07886e1b74b262d916714fa0896b0c3fd 100644 (file)
@@ -755,6 +755,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3396,
 /**/
     3395,
 /**/