From d36e46cb6e191f21bcc66f5604825e414e16a9f0 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Tue, 23 Jun 2015 13:49:56 -0600 Subject: [PATCH] Must call round_nfds() with fd+1 since it takes a count not the fd number. In other words, the lowest value is 1, not 0. --- lib/util/sudo_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/util/sudo_debug.c b/lib/util/sudo_debug.c index 9e1089746..b8efb7586 100644 --- a/lib/util/sudo_debug.c +++ b/lib/util/sudo_debug.c @@ -180,7 +180,7 @@ sudo_debug_new_output(struct sudo_debug_instance *instance, if (sudo_debug_fds_size < output->fd) { /* Bump fds size to the next multiple of 4 * NBBY. */ const int old_size = sudo_debug_fds_size / NBBY; - const int new_size = round_nfds(output->fd) / NBBY; + const int new_size = round_nfds(output->fd + 1) / NBBY; unsigned char *new_fds; new_fds = realloc(sudo_debug_fds, new_size); -- 2.49.0