]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: cfgparse-global: fix allowed args number for setenv
authorValentine Krasnobaeva <vkrasnobaeva@haproxy.com>
Mon, 30 Sep 2024 13:29:47 +0000 (15:29 +0200)
committerWilliam Lallemand <wlallemand@haproxy.com>
Tue, 1 Oct 2024 08:35:09 +0000 (10:35 +0200)
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 <name> <value>") instead of 3. For alertif_too_many_args the first
argument index is 0.

This should be backported in all stable versions.

src/cfgparse-global.c

index 3a59824cbd76b91c7eda5caf9a1dec8aafd90a29..0c8a71d0bb23b156281150d58bd3c57a37263a28 100644 (file)
@@ -798,7 +798,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) {