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.
This commit is contained in:
Willy Tarreau 2026-04-30 09:19:53 +02:00
parent 37b1f15d85
commit 2464c73526

View File

@ -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;
}
}