comparison src/vim9cmds.c @ 29744:1e9ee1b61d6d v9.0.0212

patch 9.0.0212: invalid memory access when compiling :unlet Commit: https://github.com/vim/vim/commit/dbdd16b62560413abcc3c8e893cc3010ccf31666 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Aug 14 21:46:07 2022 +0100 patch 9.0.0212: invalid memory access when compiling :unlet Problem: Invalid memory access when compiling :unlet. Solution: Don't read past the end of the line.
author Bram Moolenaar <Bram@vim.org>
date Sun, 14 Aug 2022 23:00:04 +0200
parents 2da1753e6a4a
children d269dd3cd31d
comparison
equal deleted inserted replaced
29743:806c3ef643fe 29744:1e9ee1b61d6d
90 * Check if "name" can be "unlet". 90 * Check if "name" can be "unlet".
91 */ 91 */
92 int 92 int
93 check_vim9_unlet(char_u *name) 93 check_vim9_unlet(char_u *name)
94 { 94 {
95 if (*name == NUL)
96 {
97 semsg(_(e_argument_required_for_str), "unlet");
98 return FAIL;
99 }
100
95 if (name[1] != ':' || vim_strchr((char_u *)"gwtb", *name) == NULL) 101 if (name[1] != ':' || vim_strchr((char_u *)"gwtb", *name) == NULL)
96 { 102 {
97 // "unlet s:var" is allowed in legacy script. 103 // "unlet s:var" is allowed in legacy script.
98 if (*name == 's' && !script_is_vim9()) 104 if (*name == 's' && !script_is_vim9())
99 return OK; 105 return OK;