Skip to content

Commit

Permalink
patch 8.2.3396: when libcall() fails invalid pointer may be used
Browse files Browse the repository at this point in the history
Problem:    When libcall() fails invalid pointer may be used.
Solution:   Initialize the string to NULL. (Yasuhiro Matsumoto, closes #8829)
  • Loading branch information
brammool committed Sep 2, 2021
1 parent 26a4484 commit 87e1587
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/evalfunc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
3396,
/**/
3395,
/**/
Expand Down

0 comments on commit 87e1587

Please sign in to comment.