From: Bruno Haible Date: Sat, 22 Apr 2017 12:18:45 +0000 (+0200) Subject: poll: Enable argument check. X-Git-Tag: v1.0~6261 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=518ec8ea7911bab915789a40d4c25335ba724e70;p=gnulib.git poll: Enable argument check. * lib/poll.c: Include intprops.h. (poll): Check value of nfd correctly. * modules/poll (Depends-on): Add intprops. --- diff --git a/ChangeLog b/ChangeLog index 4f11fca06d..45a7d874e4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2017-04-22 Bruno Haible + + poll: Enable argument check. + * lib/poll.c: Include intprops.h. + (poll): Check value of nfd correctly. + * modules/poll (Depends-on): Add intprops. + 2017-04-22 Bruno Haible get-rusage-data: Avoid warnings on Mac OS X. 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 #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; diff --git a/modules/poll b/modules/poll index 57f0631e72..a7d117f532 100644 --- a/modules/poll +++ b/modules/poll @@ -9,6 +9,7 @@ Depends-on: poll-h alloca [test $HAVE_POLL = 0 || test $REPLACE_POLL = 1] assure [test $HAVE_POLL = 0 || test $REPLACE_POLL = 1] +intprops [test $HAVE_POLL = 0 || test $REPLACE_POLL = 1] select [test $HAVE_POLL = 0 || test $REPLACE_POLL = 1] sockets [test $HAVE_POLL = 0 || test $REPLACE_POLL = 1] sys_select [test $HAVE_POLL = 0 || test $REPLACE_POLL = 1]