]> Savannah Git Hosting - gnulib.git/commitdiff
poll: Enable argument check also in the Windows implementation.
authorBruno Haible <bruno@clisp.org>
Sun, 23 Apr 2017 01:25:10 +0000 (03:25 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 23 Apr 2017 01:25:10 +0000 (03:25 +0200)
* lib/poll.c (poll) [WINDOWS_NATIVE]: Check value of nfd correctly.
Reported by Paul Eggert.

ChangeLog
lib/poll.c

index 25fe006255891252ceacbc23288326db5ec13669..b365e9e2ad5645395e5ad91b5336c178bcbca68e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2017-04-22  Bruno Haible  <bruno@clisp.org>
+
+        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  <bruno@clisp.org>
 
         getlogin_r: Work around bug in Mac OS X 10.12.
index 803ac0e171bcd997a9254deab84abec7c61cb11f..69b3672f75057ffaf9d1101fdd24eb79e772f5a2 100644 (file)
@@ -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;