]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: cli: Fix a crash when sending a command with too many arguments
authorAurélien Nephtali <aurelien.nephtali@corp.ovh.com>
Fri, 16 Mar 2018 09:11:06 +0000 (10:11 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 19 Mar 2018 11:15:38 +0000 (12:15 +0100)
This bug was introduced in 48bcfdab2 ("MEDIUM: dumpstat: make the CLI
parser understand the backslash as an escape char").

This should be backported to 1.8.

Signed-off-by: Aurélien Nephtali <aurelien.nephtali@corp.ovh.com>
src/cli.c

index 7bffbdd56f2638ab79e5a819c8541f2ad7889ad8..ada45a865645a784f107e177152d637f0fb49cf3 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -416,7 +416,7 @@ static int cli_parse_request(struct appctx *appctx, char *line)
 
        /* unescape '\' */
        arg = 0;
-       while (*args[arg] != '\0') {
+       while (arg <= MAX_STATS_ARGS && *args[arg] != '\0') {
                j = 0;
                for (i=0; args[arg][i] != '\0'; i++) {
                        if (args[arg][i] == '\\') {