From: Valentine Krasnobaeva Date: Mon, 30 Sep 2024 13:29:47 +0000 (+0200) Subject: BUG/MINOR: cfgparse-global: fix allowed args number for setenv X-Git-Tag: v3.0.6~81 X-Git-Url: http://git.haproxy.org/?a=commitdiff_plain;h=d53d6fb55f02da839c118c40be9e6bfd17471707;p=haproxy-3.0.git BUG/MINOR: cfgparse-global: fix allowed args number for setenv Keywords setenv and presetenv take 2 arguments: variable name and value. So, the total number, that should be passed to alertif_too_many_args is 2 ("setenv ") instead of 3. For alertif_too_many_args the first argument index is 0. This should be backported in all stable versions. (cherry picked from commit df68f7ec96c0c9d0e8f50643b96ec9062b7aa658) Signed-off-by: Christopher Faulet --- diff --git a/src/cfgparse-global.c b/src/cfgparse-global.c index aae2c01..7f9109d 100644 --- a/src/cfgparse-global.c +++ b/src/cfgparse-global.c @@ -1177,7 +1177,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) #endif /* ! USE_CPU_AFFINITY */ } else if (strcmp(args[0], "setenv") == 0 || strcmp(args[0], "presetenv") == 0) { - if (alertif_too_many_args(3, file, linenum, args, &err_code)) + if (alertif_too_many_args(2, file, linenum, args, &err_code)) goto out; if (*(args[2]) == 0) {