From 1b65cfbac5c5bbad108548908e77697111ad4a3f Mon Sep 17 00:00:00 2001 From: John Marriott Date: Mon, 11 May 2026 16:22:05 +0000 Subject: [PATCH] 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 Signed-off-by: Christian Brabandt --- src/evalvars.c | 8 +------- src/version.c | 2 ++ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/evalvars.c b/src/evalvars.c index 1df4af9972..9b98ae7310 100644 --- a/src/evalvars.c +++ b/src/evalvars.c @@ -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) diff --git a/src/version.c b/src/version.c index 5e5f17f85a..875c6f6740 100644 --- a/src/version.c +++ b/src/version.c @@ -729,6 +729,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 471, /**/ 470, /**/