From: William Lallemand Date: Fri, 6 May 2022 15:22:36 +0000 (+0200) Subject: BUG/MINOR: startup: usage() when no -cc arguments X-Git-Tag: v2.6-dev9~85 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=89e236f246fa7d643a1cbe5c50fec708faa52f0f;p=thirdparty%2Fhaproxy.git BUG/MINOR: startup: usage() when no -cc arguments Exit correctly with usage() instead of segfaulting when no argument were passed to -cc. Must be backported in 2.5. --- diff --git a/src/haproxy.c b/src/haproxy.c index ec40a64278..266f5552bc 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -1943,9 +1943,13 @@ static void init(int argc, char **argv) char *args[MAX_LINE_ARGS+1]; int arg = sizeof(args) / sizeof(*args); - size_t outlen = strlen(check_condition) + 1; + size_t outlen; char *w; + if (!check_condition) + usage(progname); + + outlen = strlen(check_condition) + 1; err = parse_line(check_condition, check_condition, &outlen, args, &arg, PARSE_OPT_ENV | PARSE_OPT_WORD_EXPAND | PARSE_OPT_DQUOTE | PARSE_OPT_SQUOTE | PARSE_OPT_BKSLASH, &errptr);