]> granicus.if.org Git - vim/commitdiff
patch 9.0.0685: FORTIFY_SOURCE causes a crash in Vim9 script v9.0.0685
authorYee Cheng Chin <ychin.git@gmail.com>
Fri, 7 Oct 2022 15:00:04 +0000 (16:00 +0100)
committerBram Moolenaar <Bram@vim.org>
Fri, 7 Oct 2022 15:00:04 +0000 (16:00 +0100)
Problem:    FORTIFY_SOURCE causes a crash in Vim9 script.
Solution:   Use a pointer to the first char. (Yee Cheng Chin, closes #11302)

src/version.c
src/vim9script.c

index 953bb229215f505f54c9afbddd675e5a9e1ee9c2..391ae4defbfe2dd54a5bb339d9e827fe7cf8c1ca 100644 (file)
@@ -699,6 +699,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    685,
 /**/
     684,
 /**/
index 913e66c8838430cf5059818c730875216f5a4e47..f6c8c49a2891a21af991a42e1ebb00b623e49860 100644 (file)
@@ -140,7 +140,8 @@ ex_vim9script(exarg_T *eap UNUSED)
                                         0L, (char_u *)CPO_VIM, OPT_NO_REDRAW);
     }
 #else
-    // No check for this being the first command, it doesn't matter.
+    // No check for this being the first command, the information is not
+    // available.
     current_sctx.sc_version = SCRIPT_VERSION_VIM9;
 #endif
 }
@@ -969,7 +970,8 @@ update_vim9_script_var(
                sv->sv_flags |= SVFLAG_ASSIGNED;
            newsav->sav_var_vals_idx = si->sn_var_vals.ga_len;
            ++si->sn_var_vals.ga_len;
-           STRCPY(&newsav->sav_key, name);
+           // a pointer to the first char avoids a FORTIFY_SOURCE problem
+           STRCPY(&newsav->sav_key[0], name);
            sv->sv_name = newsav->sav_key;
            newsav->sav_di = di;
            newsav->sav_block_id = si->sn_current_block_id;