]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: log-format: check number of arguments in cfgparse.c
authorWilliam Lallemand <wlallemand@exceliance.fr>
Sun, 11 Nov 2012 16:30:56 +0000 (17:30 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 11 Nov 2012 16:45:39 +0000 (17:45 +0100)
Exit with error if there is a second argument in the 'log-format' and
'unique-id-format' options. It is convenient when we forgot to escape
spaces.

src/cfgparse.c

index c601cbc8e30e5555d57646770768df9213a98968..6a4e0bb626743ed7cdd4fc27051aca01ee3c7e26 100644 (file)
@@ -4702,6 +4702,11 @@ stats_error_parsing:
                        err_code |= ERR_ALERT | ERR_FATAL;
                        goto out;
                }
+               if (*(args[2])) {
+                       Alert("parsing [%s:%d] : %s expects only one argument, don't forget to escape spaces!\n", file, linenum, args[0]);
+                       err_code |= ERR_ALERT | ERR_FATAL;
+                       goto out;
+               }
                free(curproxy->uniqueid_format_string);
                curproxy->uniqueid_format_string = strdup(args[1]);
        }
@@ -4722,6 +4727,11 @@ stats_error_parsing:
                        err_code |= ERR_ALERT | ERR_FATAL;
                        goto out;
                }
+               if (*(args[2])) {
+                       Alert("parsing [%s:%d] : %s expects only one argument, don't forget to escape spaces!\n", file, linenum, args[0]);
+                       err_code |= ERR_ALERT | ERR_FATAL;
+                       goto out;
+               }
 
                if (curproxy->logformat_string != default_http_log_format &&
                    curproxy->logformat_string != default_tcp_log_format &&