Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/tio.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/common/tio.c b/common/tio.c
index 0914a4a..245b7c6 100644
--- a/common/tio.c
+++ b/common/tio.c
@@ -183,6 +183,11 @@ static int tio_select(TFILE *fp, int readfd, const struct timeval *deadline)
while (1)
{
/* prepare our filedescriptorset */
+ if (fp->fd>=FD_SETSIZE)
+ {
+ errno=EBADFD;
+ return -1;
+ }
FD_ZERO(&fdset);
FD_SET(fp->fd,&fdset);
/* figure out the time we need to wait */
@@ -390,6 +395,11 @@ static int tio_flush_nonblock(TFILE *fp)
fd_set fdset;
int rv;
/* prepare our filedescriptorset */
+ if (fp->fd>=FD_SETSIZE)
+ {
+ errno=EBADFD;
+ return -1;
+ }
FD_ZERO(&fdset);
FD_SET(fp->fd,&fdset);
/* set the timeout to 0 to poll */