mirror of
https://github.com/opnsense/src.git
synced 2026-06-13 10:40:19 -04:00
Check for FD_SET overruns.
Obtained from: NetBSD
This commit is contained in:
parent
7f5231e4f3
commit
c19c8e606f
4 changed files with 10 additions and 0 deletions
|
|
@ -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 a new issue