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 <aurelien.nephtali@corp.ovh.com>
diff --git a/src/cli.c b/src/cli.c
index fbd2646..51efbc4 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -772,7 +772,7 @@
/* 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;