* src/iopoll.c (iopoll): Protect the call to select against passing in a descriptor larger than FD_SETSIZE. --- src/iopoll.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/src/iopoll.c b/src/iopoll.c index a73ce05bf..ca27595e3 100644 --- a/src/iopoll.c +++ b/src/iopoll.c @@ -86,6 +86,12 @@ iopoll (int fdin, int fdout, bool block) int nfds = (fdin > fdout ? fdin : fdout) + 1; int ret = 0; + if (FD_SETSIZE < nfds) + { + errno = EINVAL; + ret = -1; + } + /* If fdout has an error condition (like a broken pipe) it will be seen as ready for reading. Assumes fdout is not actually readable. */ while (0 <= ret || errno == EINTR) -- 2.26.2