]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: cli: Fix a crash when passing a negative or too large value to "show fd"
authorAurélien Nephtali <aurelien.nephtali@corp.ovh.com>
Fri, 9 Mar 2018 17:51:16 +0000 (18:51 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 12 Mar 2018 06:47:26 +0000 (07:47 +0100)
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 <aurelien.nephtali@corp.ovh.com>
src/cli.c

index fbd264640be97c2e1609a170fbcfc71ba3d9d68c..51efbc4458cb6be05ecbe5f0e91f2e4f19237848 100644 (file)
--- 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;