]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: cli: fix out of bounds in -S parser
authorWilliam Lallemand <wlallemand@haproxy.com>
Mon, 25 Nov 2019 08:58:37 +0000 (09:58 +0100)
committerWilliam Lallemand <wlallemand@haproxy.org>
Mon, 25 Nov 2019 09:04:34 +0000 (10:04 +0100)
Out of bounds when the number or arguments is greater than
MAX_LINE_ARGS.

Fix issue #377.

Must be backported in 2.0 and 1.9.

src/cli.c

index db695d5fd38d3652ab75f7b5f879842ec817ec4f..77db8be883259b2845afa3b09f5d779b79398ee4 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -2526,7 +2526,7 @@ int mworker_cli_proxy_new_listener(char *line)
        int arg;
        int cur_arg;
 
-       arg = 0;
+       arg = 1;
        args[0] = line;
 
        /* args is a bind configuration with spaces replaced by commas */
@@ -2536,12 +2536,12 @@ int mworker_cli_proxy_new_listener(char *line)
                        *line++ = '\0';
                        while (*line == ',')
                                line++;
-                       args[++arg] = line;
+                       args[arg++] = line;
                }
                line++;
        }
 
-       args[++arg] = "\0";
+       args[arg] = "\0";
 
        bind_conf = bind_conf_alloc(mworker_proxy, "master-socket", 0, "", xprt_get(XPRT_RAW));
        if (!bind_conf)