Check for FD_SETSIZE in silc_select to not go over.
authorPekka Riikonen <priikone@silcnet.org>
Wed, 11 May 2005 16:54:14 +0000 (16:54 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Wed, 11 May 2005 16:54:14 +0000 (16:54 +0000)
lib/silcutil/unix/silcunixschedule.c

index d27ceacdb527beb3de1eef7ac02dc6305d02e7e7..7143e7afbd23a9fe0bc08756108abef7e33ced8b 100644 (file)
@@ -36,6 +36,11 @@ int silc_select(SilcScheduleFd fds, SilcUInt32 fds_count,
     if (!fds[i].events)
       continue;
 
+#ifdef FD_SETSIZE
+    if (fds[i].fd >= FD_SETSIZE)
+      break;
+#endif /* FD_SETSIZE */
+
     if (fds[i].fd > max_fd)
       max_fd = fds[i].fd;
 
@@ -55,6 +60,11 @@ int silc_select(SilcScheduleFd fds, SilcUInt32 fds_count,
     if (!fds[i].events)
       continue;
 
+#ifdef FD_SETSIZE
+    if (fds[i].fd >= FD_SETSIZE)
+      break;
+#endif /* FD_SETSIZE */
+
     if (FD_ISSET(fds[i].fd, &in))
       fds[i].revents |= SILC_TASK_READ;
     if (FD_ISSET(fds[i].fd, &out))