From 2464c735269816fe103a217528609e158d3a75dc Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 30 Apr 2026 09:19:53 +0200 Subject: [PATCH] BUG/MINOR: vars: only print first invalid char in fill_desc() The variable name is passed as (ptr,len) suggesting that certain callers might not always have 0-terminated strings (e.g. when used in arguments where closing parenthesis or commas might follow), the error message carefully tries to designate the first invalid character, yet by mistake it prints the whole string. This mistake has been there since commit 4834bc773c ("MEDIUM: vars: adds support of variables") in 1.6. Let's properly report the char as promised instead. This could be backported but is totally unimportant. --- src/vars.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vars.c b/src/vars.c index 453c5f2ed..6375e9b34 100644 --- a/src/vars.c +++ b/src/vars.c @@ -328,7 +328,7 @@ static int vars_fill_desc(const char *name, int len, struct var_desc *desc, char /* Check variable name syntax. */ for (tmp = name; tmp < name + len; tmp++) { if (!isalnum((unsigned char)*tmp) && *tmp != '_' && *tmp != '.') { - memprintf(err, "invalid syntax at char '%s'", tmp); + memprintf(err, "invalid syntax at char '%c'", *tmp); return 0; } }