From: Bruno Haible Date: Sun, 23 Apr 2017 01:25:10 +0000 (+0200) Subject: poll: Enable argument check also in the Windows implementation. X-Git-Tag: v1.0~6253 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=701114aa6a4c403cf99775b1a66df42699af8f42;p=gnulib.git poll: Enable argument check also in the Windows implementation. * lib/poll.c (poll) [WINDOWS_NATIVE]: Check value of nfd correctly. Reported by Paul Eggert. --- diff --git a/ChangeLog b/ChangeLog index 25fe006255..b365e9e2ad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2017-04-22 Bruno Haible + + poll: Enable argument check also in the Windows implementation. + * lib/poll.c (poll) [WINDOWS_NATIVE]: Check value of nfd correctly. + Reported by Paul Eggert. + 2017-04-22 Bruno Haible getlogin_r: Work around bug in Mac OS X 10.12. diff --git a/lib/poll.c b/lib/poll.c index 803ac0e171..69b3672f75 100644 --- a/lib/poll.c +++ b/lib/poll.c @@ -434,7 +434,7 @@ poll (struct pollfd *pfd, nfds_t nfd, int timeout) int rc = 0; nfds_t i; - if (nfd < 0 || timeout < -1) + if (nfd > TYPE_MAXIMUM (nfds_t) / 2 || timeout < -1) { errno = EINVAL; return -1;