mirror of
https://github.com/curl/curl.git
synced 2025-04-06 16:10:34 +08:00
Curl_socket_check: add extra check to avoid integer overflow
This commit is contained in:
parent
d18c546454
commit
9aa2afc3a5
@ -165,6 +165,12 @@ int Curl_socket_check(curl_socket_t readfd0, /* two sockets to read from */
|
||||
int r;
|
||||
int ret;
|
||||
|
||||
#if SIZEOF_LONG != SIZEOF_INT
|
||||
/* wrap-around precaution */
|
||||
if(timeout_ms >= INT_MAX)
|
||||
timeout_ms = INT_MAX;
|
||||
#endif
|
||||
|
||||
if((readfd0 == CURL_SOCKET_BAD) && (readfd1 == CURL_SOCKET_BAD) &&
|
||||
(writefd == CURL_SOCKET_BAD)) {
|
||||
/* no sockets, just wait */
|
||||
|
Loading…
x
Reference in New Issue
Block a user