aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMarc Hoersken <info@marc-hoersken.de>2020-03-12 09:34:34 +0100
committerMarc Hoersken <info@marc-hoersken.de>2020-03-15 11:08:27 +0100
commit696cfc0f6ca4f4cf822cef50ff6ea8c012a016df (patch)
treef01637caa56cd446cbc41d4a922f38c73845545d /lib
parent041e778f1e864f57d98757704378acb14c9d873e (diff)
select: add 'timeout_ms' wrap-around precaution to Curl_select
Diffstat (limited to 'lib')
-rw-r--r--lib/select.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/select.c b/lib/select.c
index bbada45fc..1ab023934 100644
--- a/lib/select.c
+++ b/lib/select.c
@@ -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) &&