]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MINOR: cfgparse-global: reject extra arguments to numa-cpu-mapping and anonkey
authorWilly Tarreau <w@1wt.eu>
Tue, 15 Sep 2026 14:37:58 +0000 (16:37 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 9 Oct 2026 07:22:33 +0000 (09:22 +0200)
Both keywords silently ignored anything passed after their expected
argument, contrary to all the other keywords of the section which
properly check for extra args. Let's just fix this.

This must NOT be backported since it makes the config parser stricter.

src/cfgparse-global.c

index 1d214669269586ca482f3cbad2c8c63c64c8cb4d..1587c26bcde6d499535290b208cadf37c8322e0a 100644 (file)
@@ -832,11 +832,15 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
                        global.tune.options &= ~GTUNE_STRICT_LIMITS;
        }
        else if (strcmp(args[0], "numa-cpu-mapping") == 0) {
+               if (alertif_too_many_args(0, file, linenum, args, &err_code))
+                       goto out;
                global.numa_cpu_mapping = (kwm == KWM_NO) ? 0 : 1;
        }
        else if (strcmp(args[0], "anonkey") == 0) {
                long long tmp = 0;
 
+               if (alertif_too_many_args(1, file, linenum, args, &err_code))
+                       goto out;
                if (*args[1] == 0) {
                        ha_alert("parsing [%s:%d]: a key is expected after '%s'.\n",
                                 file, linenum, args[0]);