BUG/MINOR: cli: fix out of bounds in -S parser
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.
(cherry picked from commit 2e945c8ee7d5cb358d98c4333a66b0d6631cefa6)
Signed-off-by: William Lallemand <wlallemand@haproxy.org>
diff --git a/src/cli.c b/src/cli.c
index c063fbf..3612577 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -2529,7 +2529,7 @@
int arg;
int cur_arg;
- arg = 0;
+ arg = 1;
args[0] = line;
/* args is a bind configuration with spaces replaced by commas */
@@ -2539,12 +2539,12 @@
*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)