Fix denial of service - memory corruption.
[samba.git] / source3 / winbindd / winbindd.c
index 0443ebfdf2cdb6362f402b3dc05d822305990660..b72d42b49183a4f046064ce1ecfeb3a0bd710da4 100644 (file)
@@ -1064,6 +1064,12 @@ static void process_loop(void)
        }
 
        for (ev = fd_events; ev; ev = ev->next) {
+               if (ev->fd < 0 || ev->fd >= FD_SETSIZE) {
+                       /* Ignore here - event_add_to_select_args
+                          should make this impossible. */
+                       continue;
+               }
+
                if (ev->flags & EVENT_FD_READ) {
                        FD_SET(ev->fd, &r_fds);
                        maxfd = MAX(ev->fd, maxfd);