select: add 'timeout_ms' wrap-around precaution to Curl_select

This commit is contained in:
Marc Hoersken 2020-03-12 09:34:34 +01:00
parent 041e778f1e
commit 696cfc0f6c
No known key found for this signature in database
GPG Key ID: 61E03CBED7BC859E
1 changed files with 6 additions and 0 deletions

View 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) &&