From 696cfc0f6ca4f4cf822cef50ff6ea8c012a016df Mon Sep 17 00:00:00 2001 From: Marc Hoersken Date: Thu, 12 Mar 2020 09:34:34 +0100 Subject: select: add 'timeout_ms' wrap-around precaution to Curl_select --- lib/select.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/select.c') 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) && -- cgit v1.2.3