From: Aurélien Nephtali Date: Fri, 9 Mar 2018 17:51:16 +0000 (+0100) Subject: BUG/MINOR: cli: Fix a crash when passing a negative or too large value to "show fd" X-Git-Tag: v1.9-dev1~381 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=498a1157279c3dcd5d83d0fcb80eecd7f108d028;p=thirdparty%2Fhaproxy.git BUG/MINOR: cli: Fix a crash when passing a negative or too large value to "show fd" This bug is present since 7a4a0ac71d ("MINOR: cli: add a new "show fd" command"). This should be backported to 1.8. Signed-off-by: Aurélien Nephtali --- diff --git a/src/cli.c b/src/cli.c index fbd264640b..51efbc4458 100644 --- a/src/cli.c +++ b/src/cli.c @@ -772,7 +772,7 @@ static int cli_io_handler_show_fd(struct appctx *appctx) /* we have two inner loops here, one for the proxy, the other one for * the buffer. */ - while (fd < global.maxsock) { + while (fd >= 0 && fd < global.maxsock) { struct fdtab fdt; struct listener *li = NULL; struct server *sv = NULL;