]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: config: Alert about extra arguments for errorfile and errorloc
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 3 Jan 2025 09:10:08 +0000 (10:10 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 3 Jan 2025 09:10:09 +0000 (10:10 +0100)
errorfile and errorloc directives expect excatly two arguments. But extra
arguments were just ignored while an error should be emitted. It is now
fixed.

This patch could be backported as far as 2.2 if necessary.

src/http_htx.c

index fbadb1014b00c787f90ddf0c6f77ef701e5139fe..97cf8f37eeeccd4706a031e700a6221a5eefc3c2 100644 (file)
@@ -1999,6 +1999,11 @@ static int proxy_parse_errorloc(char **args, int section, struct proxy *curpx,
                ret = -1;
                goto out;
        }
+       if (*(args[3])) {
+               memprintf(errmsg, "%s : expects exactly two arguments.\n", args[0]);
+               ret = -1;
+               goto out;
+       }
 
        status = atol(args[1]);
        errloc = (strcmp(args[0], "errorloc303") == 0 ? 303 : 302);
@@ -2066,6 +2071,11 @@ static int proxy_parse_errorfile(char **args, int section, struct proxy *curpx,
                ret = -1;
                goto out;
        }
+       if (*(args[3])) {
+               memprintf(errmsg, "%s : expects exactly two arguments.\n", args[0]);
+               ret = -1;
+               goto out;
+       }
 
        status = atol(args[1]);
        msg = http_parse_errorfile(status, args[2], errmsg);