]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
select: add 'timeout_ms' wrap-around precaution to Curl_select
authorMarc Hoersken <info@marc-hoersken.de>
Thu, 12 Mar 2020 08:34:34 +0000 (09:34 +0100)
committerMarc Hoersken <info@marc-hoersken.de>
Sun, 15 Mar 2020 10:08:27 +0000 (11:08 +0100)
lib/select.c

index bbada45fc93ce70dd4cc1c4f063ef31cab6bd270..1ab023934235cd228794e722bae525255dfbd988 100644 (file)
@@ -122,6 +122,12 @@ int Curl_select(curl_socket_t maxfd,
   int pending_ms;
   int r;
 
+#if SIZEOF_TIME_T != SIZEOF_INT
+  /* wrap-around precaution */
+  if(timeout_ms >= INT_MAX)
+    timeout_ms = INT_MAX;
+#endif
+
 #ifdef USE_WINSOCK
   /* WinSock select() can't handle zero events.  See the comment below. */
   if((!fds_read || fds_read->fd_count == 0) &&