From: Marc Hoersken Date: Thu, 12 Mar 2020 08:34:34 +0000 (+0100) Subject: select: add 'timeout_ms' wrap-around precaution to Curl_select X-Git-Tag: curl-7_70_0~241 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=696cfc0f6ca4f4cf822cef50ff6ea8c012a016df;p=thirdparty%2Fcurl.git select: add 'timeout_ms' wrap-around precaution to Curl_select --- diff --git a/lib/select.c b/lib/select.c index bbada45fc9..1ab0239342 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) &&