From: Thierry FOURNIER / OZON.IO Date: Mon, 12 Dec 2016 11:42:14 +0000 (+0100) Subject: BUG/MEDIUM: variables: some variable name can hide another ones X-Git-Tag: v1.8-dev1~303 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d2f6f47597844e07c393bf9224c99bc31538512c;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: variables: some variable name can hide another ones The variable are compared only using text, the final '\0' (or the string length) are not checked. So, the variable name "txn.internal" matchs other one call "txn.int". This patch fix this behavior It must be backported ni 1.6 and 1.7 --- diff --git a/src/vars.c b/src/vars.c index 4d18a4fd8f..e5448e526b 100644 --- a/src/vars.c +++ b/src/vars.c @@ -201,7 +201,7 @@ static char *register_name(const char *name, int len, enum vars_scope *scope, /* Look for existing variable name. */ for (i = 0; i < var_names_nb; i++) - if (strncmp(var_names[i], name, len) == 0) + if (strncmp(var_names[i], name, len) == 0 && var_names[i][len] == '\0') return var_names[i]; if (!alloc)