Check for FD_SET overruns.
Obtained from: NetBSD
This commit is contained in:
parent
342bf9a702
commit
46adc04a10
@ -349,10 +349,14 @@ main(argc, argv)
|
||||
sigaction(SIGUSR1, &sa, NULL);
|
||||
sigaction(SIGUSR2, &sa, NULL);
|
||||
|
||||
if (igmp_socket >= FD_SETSIZE)
|
||||
log(LOG_ERR, 0, "descriptor too big");
|
||||
FD_ZERO(&readers);
|
||||
FD_SET(igmp_socket, &readers);
|
||||
nfds = igmp_socket + 1;
|
||||
for (i = 0; i < nhandlers; i++) {
|
||||
if (ihandlers[i].fd >= FD_SETSIZE)
|
||||
log(LOG_ERR, 0, "descriptor too big");
|
||||
FD_SET(ihandlers[i].fd, &readers);
|
||||
if (ihandlers[i].fd >= nfds)
|
||||
nfds = ihandlers[i].fd + 1;
|
||||
|
@ -943,6 +943,8 @@ int main(argc, argv)
|
||||
struct timeval tv;
|
||||
int count, recvlen, dummy = 0;
|
||||
|
||||
if (igmp_socket >= FD_SETSIZE)
|
||||
log(LOG_ERR, 0, "descriptor too big");
|
||||
FD_ZERO(&fds);
|
||||
FD_SET(igmp_socket, &fds);
|
||||
|
||||
|
@ -434,6 +434,8 @@ main(argc, argv)
|
||||
struct igmp *igmp;
|
||||
int ipdatalen, iphdrlen, igmpdatalen;
|
||||
|
||||
if (igmp_socket >= FD_SETSIZE)
|
||||
log(LOG_ERR, 0, "descriptor too big");
|
||||
FD_ZERO(&fds);
|
||||
FD_SET(igmp_socket, &fds);
|
||||
|
||||
|
@ -1276,6 +1276,8 @@ send_recv(dst, type, code, tries, save, callback)
|
||||
* Wait for response, discarding false alarms
|
||||
*/
|
||||
while (TRUE) {
|
||||
if (igmp_socket >= FD_SETSIZE)
|
||||
log(LOG_ERR, 0, "descriptor too big");
|
||||
FD_ZERO(&fds);
|
||||
FD_SET(igmp_socket, &fds);
|
||||
gettimeofday(&tv, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user