Fix crash when the number of file descriptors grows and then shrinks
This is a bit of an embarrassing bug. The allocated size of the array and the number of elements are not always the same. Reported by Fridtjof Busse.
This commit is contained in:
parent
253d41890a
commit
173fc6a221
|
@ -4961,10 +4961,10 @@ static int do_main(int argc, char **argv, const char *connection_path)
|
|||
}
|
||||
|
||||
/* POLL */
|
||||
(g_main_context_get_poll_func(context))(fds, nfds, timeout);
|
||||
(g_main_context_get_poll_func(context))(fds, needed_fds + 1, timeout);
|
||||
|
||||
/* CHECK */
|
||||
bool ready = g_main_context_check(context, max_priority, fds + 1, nfds - 1);
|
||||
bool ready = g_main_context_check(context, max_priority, fds + 1, needed_fds);
|
||||
|
||||
/* DISPATCH */
|
||||
if (ready) {
|
||||
|
|
Loading…
Reference in New Issue