BFD: Fix invalid read from pollfd array

It is possible that sockets_add() are called between sockets_prepare()
and sockets_fire() during poll loop in birdloop_main(), so we need to
use loop->poll_fd.used instead of loop->sock_num to find the last field.
This commit is contained in:
Pavel Tvrdik 2016-09-08 13:45:36 +02:00 committed by Ondrej Zajicek (work)
parent a290da25a1
commit 0f5054f685

View file

@ -589,7 +589,7 @@ sockets_fire(struct birdloop *loop)
times_update(loop);
/* Last fd is internal wakeup fd */
if (pfd[loop->sock_num].revents & POLLIN)
if (pfd[poll_num].revents & POLLIN)
wakeup_drain(loop);
int i;