(loop, proto): check that the fd's aren't too large to select on

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@9185 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
2000-11-15 22:58:53 +00:00
parent 97efaf8a8a
commit f64041aa23

View File

@@ -62,6 +62,9 @@ loop (int s, int errsock)
fd_set real_readset; fd_set real_readset;
int count = 1; int count = 1;
if (s >= FD_SETSIZE || errsock >= FD_SETSIZE)
errx (1, "fd too large");
FD_ZERO(&real_readset); FD_ZERO(&real_readset);
FD_SET(s, &real_readset); FD_SET(s, &real_readset);
if (errsock != -1) { if (errsock != -1) {
@@ -445,6 +448,9 @@ proto (int s, int errsock,
for (;;) { for (;;) {
fd_set fdset; fd_set fdset;
if (errsock >= FD_SETSIZE || s >= FD_SETSIZE)
errx (1, "fd too large");
FD_ZERO(&fdset); FD_ZERO(&fdset);
FD_SET(errsock, &fdset); FD_SET(errsock, &fdset);
FD_SET(s, &fdset); FD_SET(s, &fdset);