Hello, Here is a small patch to fix a crash that occurs when trying to "show fd" on a negative (or too large) fd value:
$ echo "show fd -1" | socat /tmp/sock1 stdio $ echo "show fd 999999999999" | socat /tmp/sock1 stdio -- Aurélien.
>From 7a1a8fe760a50cf3afdd630090468b4657a6de9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Nephtali?= <[email protected]> Date: Fri, 9 Mar 2018 18:51:16 +0100 Subject: [PATCH] MINOR/BUG: cli: Fix a crash when passing a negative or too large value to "show fd" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 <[email protected]> --- src/cli.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cli.c b/src/cli.c index fbd264640..51efbc445 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; -- 2.11.0

