summaryrefslogtreecommitdiff
path: root/lib/pselect.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/pselect.c')
-rw-r--r--lib/pselect.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/pselect.c b/lib/pselect.c
index f5d21e1048..52d3837878 100644
--- a/lib/pselect.c
+++ b/lib/pselect.c
@@ -45,6 +45,12 @@ pselect (int nfds, fd_set *restrict rfds,
sigset_t origmask;
struct timeval tv, *tvp;
+ if (nfds < 0 || nfds > FD_SETSIZE)
+ {
+ errno = EINVAL;
+ return -1;
+ }
+
if (timeout)
{
if (! (0 <= timeout->tv_nsec && timeout->tv_nsec < 1000000000))