changeset 25721:0612d28321e8 v8.2.3396

patch 8.2.3396: when libcall() fails invalid pointer may be used Commit: https://github.com/vim/vim/commit/87e1587b8add93e40340170e4261cdadc4c8940e Author: Bram Moolenaar <Bram@vim.org> Date: Thu Sep 2 19:53:07 2021 +0200 patch 8.2.3396: when libcall() fails invalid pointer may be used Problem: When libcall() fails invalid pointer may be used. Solution: Initialize the string to NULL. (Yasuhiro Matsumoto, closes https://github.com/vim/vim/issues/8829)
author Bram Moolenaar <Bram@vim.org>
date Thu, 02 Sep 2021 20:00:05 +0200
parents ebc29a793c7d
children b86f0758cce8
files src/evalfunc.c src/version.c
diffstat 2 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -6689,9 +6689,14 @@ libcall_common(typval_T *argvars UNUSED,
 	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,
--- a/src/version.c
+++ b/src/version.c
@@ -756,6 +756,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    3396,
+/**/
     3395,
 /**/
     3394,