From: Willy Tarreau Date: Mon, 10 May 2021 05:47:05 +0000 (+0200) Subject: BUILD: cli: appease a null-deref warning in cli_gen_usage_msg() X-Git-Tag: v2.4-dev19~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5db446d7e1325322fc950a28d77e8f7b947ff227;p=thirdparty%2Fhaproxy.git BUILD: cli: appease a null-deref warning in cli_gen_usage_msg() The compiler sees the possibility of null-deref for which a path is possible but which doesn't exist as we didn't pass a null args outside of the help request. The test was introduced by the simplified test on ishelp variable, so let's add it to shut the warning. --- diff --git a/src/cli.c b/src/cli.c index c2464b9e25..24144ddedd 100644 --- a/src/cli.c +++ b/src/cli.c @@ -143,7 +143,7 @@ static char *cli_gen_usage_msg(struct appctx *appctx, char * const *args) chunk_reset(tmp); if (ishelp) // this is the help message. chunk_strcat(tmp, "The following commands are valid at this level:\n"); - else if (!length && (!*args || !**args)) // no match + else if (!length && (!args || !*args || !**args)) // no match chunk_strcat(tmp, "Unknown command. Please enter one of the following commands only:\n"); else // partial match chunk_strcat(tmp, "Unknown command, but maybe one of the following ones is a better match:\n");