From 42398166645c00f43738696d33277e220123323e Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Wed, 7 Aug 2019 20:02:46 +0000 Subject: iopause_select: add protection against UB in FD_SET --- src/libstddjb/iopause_select.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/libstddjb/iopause_select.c b/src/libstddjb/iopause_select.c index 8b8479b..a98767c 100644 --- a/src/libstddjb/iopause_select.c +++ b/src/libstddjb/iopause_select.c @@ -35,6 +35,7 @@ int iopause_select (iopause_fd *x, unsigned int len, tain_t const *deadline, tai x[i].revents = 0 ; if (x[i].fd >= 0) { + if (x[i].fd >= FD_SETSIZE) return (errno = EMFILE, -1) ; if (x[i].fd >= nfds) nfds = x[i].fd + 1 ; if (x[i].events & IOPAUSE_READ) FD_SET(x[i].fd, &rfds) ; if (x[i].events & IOPAUSE_WRITE) FD_SET(x[i].fd, &wfds) ; -- cgit v1.2.3