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.
This commit is contained in:
@@ -180,7 +180,7 @@ sudo_debug_new_output(struct sudo_debug_instance *instance,
|
|||||||
if (sudo_debug_fds_size < output->fd) {
|
if (sudo_debug_fds_size < output->fd) {
|
||||||
/* Bump fds size to the next multiple of 4 * NBBY. */
|
/* Bump fds size to the next multiple of 4 * NBBY. */
|
||||||
const int old_size = sudo_debug_fds_size / 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;
|
unsigned char *new_fds;
|
||||||
|
|
||||||
new_fds = realloc(sudo_debug_fds, new_size);
|
new_fds = realloc(sudo_debug_fds, new_size);
|
||||||
|
Reference in New Issue
Block a user