]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1242: Crash when evaluating variable name v9.1.1242
authorChristian Brabandt <cb@256bit.org>
Wed, 26 Mar 2025 18:25:57 +0000 (19:25 +0100)
committerChristian Brabandt <cb@256bit.org>
Wed, 26 Mar 2025 18:25:57 +0000 (19:25 +0100)
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 <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/eval.c
src/version.c

index c2856fe72cc419d6781a4e017ca4c2feb36e76bf..923e7a43d9bfe130bb40f1ae6ad9f8ef28c4f953 100644 (file)
@@ -2163,6 +2163,8 @@ get_lval(
            }
        }
        lp->ll_name = lp->ll_exp_name;
+       if (lp->ll_name != NULL)
+           lp->ll_name_end = lp->ll_name + STRLEN(lp->ll_name);
     }
     else
     {
@@ -2373,7 +2375,7 @@ set_var_lval(
 
            // handle +=, -=, *=, /=, %= and .=
            di = NULL;
-           if (eval_variable(lp->ll_name, (int)(lp->ll_name_end - lp->ll_name),
+           if (eval_variable(lp->ll_name, (int)STRLEN(lp->ll_name),
                                 lp->ll_sid, &tv, &di, EVAL_VAR_VERBOSE) == OK)
            {
                if (di != NULL && check_typval_is_value(&di->di_tv) == FAIL)
index 63214b6a21429063cdcf224259271d11e995d1bc..db9588e6cb884a739b3a6f0ec4b8b9cbe701374b 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1242,
 /**/
     1241,
 /**/