summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYee Cheng Chin <ychin.git@gmail.com>2022-10-07 16:00:04 +0100
committerBram Moolenaar <Bram@vim.org>2022-10-07 16:00:04 +0100
commit07eaa1ede4a39b6a95203beebd94943b62a216c1 (patch)
tree04a6e747f6108b902539d3625b7981c620116831
parent2eae3d24d7fe8beed64652bc5c1cbddd09dafc9a (diff)
downloadvim-git-07eaa1ede4a39b6a95203beebd94943b62a216c1.tar.gz
patch 9.0.0685: FORTIFY_SOURCE causes a crash in Vim9 scriptv9.0.0685
Problem: FORTIFY_SOURCE causes a crash in Vim9 script. Solution: Use a pointer to the first char. (Yee Cheng Chin, closes #11302)
-rw-r--r--src/version.c2
-rw-r--r--src/vim9script.c6
2 files changed, 6 insertions, 2 deletions
diff --git a/src/version.c b/src/version.c
index 953bb2292..391ae4def 100644
--- a/src/version.c
+++ b/src/version.c
@@ -700,6 +700,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 685,
+/**/
684,
/**/
683,
diff --git a/src/vim9script.c b/src/vim9script.c
index 913e66c88..f6c8c49a2 100644
--- a/src/vim9script.c
+++ b/src/vim9script.c
@@ -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;