From: Willy Tarreau Date: Fri, 3 Sep 2021 08:12:55 +0000 (+0200) Subject: BUG/MINOR: vars: truncate the variable name in error reports about scope. X-Git-Tag: v2.5-dev6~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1402fef58aedbac671dd81b4ac93dc7008fcde50;p=thirdparty%2Fhaproxy.git BUG/MINOR: vars: truncate the variable name in error reports about scope. When a variable starts with the wrong scope, it is named without stripping the extra characters that follow it, which usually are closing parenthesis. Let's make sure we only report what is expected. This may be backported to 2.4. --- diff --git a/src/vars.c b/src/vars.c index 85c6fc4bdd..e4e547afd2 100644 --- a/src/vars.c +++ b/src/vars.c @@ -261,8 +261,8 @@ static char *register_name(const char *name, int len, enum vars_scope *scope, *scope = SCOPE_CHECK; } else { - memprintf(err, "invalid variable name '%s'. A variable name must be start by its scope. " - "The scope can be 'proc', 'sess', 'txn', 'req', 'res' or 'check'", name); + memprintf(err, "invalid variable name '%.*s'. A variable name must be start by its scope. " + "The scope can be 'proc', 'sess', 'txn', 'req', 'res' or 'check'", len, name); return res; }