Skip to content

Commit 06774a2

Browse files
chrisbrazeertzjq
andcommitted
patch 9.1.1242: Crash when evaluating variable name
Problem: Crash when evaluating variable name (after v9.1.0870) Solution: calculate the strlen() directly instead of pointer arithmetics, fix missing assignment to lp->ll_name_end in get_lval() (zeertzjq) closes: #16972 fixes: vim-airline/vim-airline#2710 related: #16066 Co-authored-by: zeertzjq <[email protected]> Signed-off-by: Christian Brabandt <[email protected]>
1 parent 4dd17a9 commit 06774a2

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

src/eval.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2163,6 +2163,8 @@ get_lval(
21632163
}
21642164
}
21652165
lp->ll_name = lp->ll_exp_name;
2166+
if (lp->ll_name != NULL)
2167+
lp->ll_name_end = lp->ll_name + STRLEN(lp->ll_name);
21662168
}
21672169
else
21682170
{
@@ -2373,7 +2375,7 @@ set_var_lval(
23732375

23742376
// handle +=, -=, *=, /=, %= and .=
23752377
di = NULL;
2376-
if (eval_variable(lp->ll_name, (int)(lp->ll_name_end - lp->ll_name),
2378+
if (eval_variable(lp->ll_name, (int)STRLEN(lp->ll_name),
23772379
lp->ll_sid, &tv, &di, EVAL_VAR_VERBOSE) == OK)
23782380
{
23792381
if (di != NULL && check_typval_is_value(&di->di_tv) == FAIL)

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,8 @@ static char *(features[]) =
704704

705705
static int included_patches[] =
706706
{ /* Add new patch number below this line */
707+
/**/
708+
1242,
707709
/**/
708710
1241,
709711
/**/

0 commit comments

Comments
 (0)