mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 22:31:28 +02:00
BUG/MEDIUM: fix segfault when no argument to -x option
This patch fixes a segfault in the command line parser. When haproxy is launched with -x with no argument and -x is the latest option in argv it segfaults. Use usage() insteads of exit() on error.
This commit is contained in:
parent
4a5be934f1
commit
45eff44e28
@ -1279,9 +1279,9 @@ static void init(int argc, char **argv)
|
|||||||
else if (*flag == 'q')
|
else if (*flag == 'q')
|
||||||
arg_mode |= MODE_QUIET;
|
arg_mode |= MODE_QUIET;
|
||||||
else if (*flag == 'x') {
|
else if (*flag == 'x') {
|
||||||
if (argv[1][0] == '-') {
|
if (argc <= 1 || argv[1][0] == '-') {
|
||||||
Alert("Unix socket path expected with the -x flag\n");
|
Alert("Unix socket path expected with the -x flag\n\n");
|
||||||
exit(1);
|
usage(progname);
|
||||||
}
|
}
|
||||||
old_unixsocket = argv[1];
|
old_unixsocket = argv[1];
|
||||||
argv++;
|
argv++;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user