0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 9.0.0685: FORTIFY_SOURCE causes a crash in Vim9 script

Problem:    FORTIFY_SOURCE causes a crash in Vim9 script.
Solution:   Use a pointer to the first char. (Yee Cheng Chin, closes #11302)
This commit is contained in:
Yee Cheng Chin
2022-10-07 16:00:04 +01:00
committed by Bram Moolenaar
parent 2eae3d24d7
commit 07eaa1ede4
2 changed files with 6 additions and 2 deletions

View 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;