mirror of
https://github.com/vim/vim.git
synced 2026-05-28 00:21:37 +02:00
patch 9.2.0471: vimvars di_key initialized at runtime
Problem: evalvars_init() copies each vimvar's name into di_key at
startup and runtime-checks that the name fits in
DICTITEM16_KEY_LEN, even though all names are known at
compile time.
Solution: Embed the name in di_key via the VV_NAME macro so the
initialization happens at compile time. Drop the
runtime length check and the STRCPY loop (John Marriott).
closes: #20185
Signed-off-by: John Marriott <basilisk@internode.on.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
852f4f43ca
commit
1b65cfbac5
+1
-7
@@ -37,7 +37,7 @@ static hashtab_T compat_hashtab;
|
||||
#define VV_RO 2 // read-only
|
||||
#define VV_RO_SBX 4 // read-only in the sandbox
|
||||
|
||||
#define VV_NAME(s, t) s, {{t, 0, {0}}, 0, {0}}
|
||||
#define VV_NAME(s, t) s, {{t, 0, {0}}, 0, {s}}
|
||||
|
||||
typedef struct vimvar vimvar_T;
|
||||
|
||||
@@ -216,12 +216,6 @@ evalvars_init(void)
|
||||
for (i = 0; i < VV_LEN; ++i)
|
||||
{
|
||||
p = &vimvars[i];
|
||||
if (STRLEN(p->vv_name) > DICTITEM16_KEY_LEN)
|
||||
{
|
||||
iemsg("Name too long, increase size of dictitem16_T");
|
||||
getout(1);
|
||||
}
|
||||
STRCPY(p->vv_di.di_key, p->vv_name);
|
||||
if (p->vv_flags & VV_RO)
|
||||
p->vv_di.di_flags = DI_FLAGS_RO | DI_FLAGS_FIX;
|
||||
else if (p->vv_flags & VV_RO_SBX)
|
||||
|
||||
@@ -729,6 +729,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
471,
|
||||
/**/
|
||||
470,
|
||||
/**/
|
||||
|
||||
Reference in New Issue
Block a user