summaryrefslogtreecommitdiff
path: root/lib/poll.c
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2017-04-22 14:18:45 +0200
committerBruno Haible <bruno@clisp.org>2017-04-22 14:18:45 +0200
commit518ec8ea7911bab915789a40d4c25335ba724e70 (patch)
tree345342a22b4830699bcaf4ea3f0c0c1e37c34a44 /lib/poll.c
parent04e8f490345f99f6e9ac5c8ed403c7f095a52eb7 (diff)
downloadgnulib-518ec8ea7911bab915789a40d4c25335ba724e70.tar.gz
poll: Enable argument check.
* lib/poll.c: Include intprops.h. (poll): Check value of nfd correctly. * modules/poll (Depends-on): Add intprops.
Diffstat (limited to 'lib/poll.c')
-rw-r--r--lib/poll.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/poll.c b/lib/poll.c
index 88d9292d5d..803ac0e171 100644
--- a/lib/poll.c
+++ b/lib/poll.c
@@ -60,6 +60,7 @@
#include <time.h>
#include "assure.h"
+#include "intprops.h"
#ifndef INFTIM
# define INFTIM (-1)
@@ -335,7 +336,7 @@ poll (struct pollfd *pfd, nfds_t nfd, int timeout)
int maxfd, rc;
nfds_t i;
- if (nfd < 0)
+ if (nfd > TYPE_MAXIMUM (nfds_t) / 2)
{
errno = EINVAL;
return -1;