summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authornectar <nectar@FreeBSD.org>2002-09-09 15:45:28 +0000
committernectar <nectar@FreeBSD.org>2002-09-09 15:45:28 +0000
commitbdb08fa9d19da90ff90e0b5e8da07ad1cfef1213 (patch)
tree7aae14533d9077b7ec771b13c1d2759150bcd268 /usr.sbin
parent722d004d66f048223bd633f9ed9a0893adce6f70 (diff)
downloadFreeBSD-src-bdb08fa9d19da90ff90e0b5e8da07ad1cfef1213.zip
FreeBSD-src-bdb08fa9d19da90ff90e0b5e8da07ad1cfef1213.tar.gz
Check for FD_SET overruns.
Obtained from: NetBSD
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/mrouted/main.c4
-rw-r--r--usr.sbin/mrouted/mapper.c2
-rw-r--r--usr.sbin/mrouted/mrinfo.c2
-rw-r--r--usr.sbin/mrouted/mtrace.c2
4 files changed, 10 insertions, 0 deletions
diff --git a/usr.sbin/mrouted/main.c b/usr.sbin/mrouted/main.c
index 87ab3ff..72c52fe 100644
--- a/usr.sbin/mrouted/main.c
+++ b/usr.sbin/mrouted/main.c
@@ -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;
diff --git a/usr.sbin/mrouted/mapper.c b/usr.sbin/mrouted/mapper.c
index 0f09835..8fdbad0 100644
--- a/usr.sbin/mrouted/mapper.c
+++ b/usr.sbin/mrouted/mapper.c
@@ -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);
diff --git a/usr.sbin/mrouted/mrinfo.c b/usr.sbin/mrouted/mrinfo.c
index a9f9dd9..1df6577 100644
--- a/usr.sbin/mrouted/mrinfo.c
+++ b/usr.sbin/mrouted/mrinfo.c
@@ -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);
diff --git a/usr.sbin/mrouted/mtrace.c b/usr.sbin/mrouted/mtrace.c
index 86655af..c129b46 100644
--- a/usr.sbin/mrouted/mtrace.c
+++ b/usr.sbin/mrouted/mtrace.c
@@ -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);
OpenPOWER on IntegriCloud