diff options
author | Daniel Stenberg <daniel@haxx.se> | 2016-10-18 09:45:34 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2016-10-18 09:45:34 +0200 |
commit | 9aa2afc3a57939e9cfc04926a2ffc20fb87286cf (patch) | |
tree | bf872208d50c9b0bd5e6a2c9b67a71a38977c41c /lib | |
parent | d18c5464541185e43a3fbaae5a36b4ce75343d79 (diff) |
Curl_socket_check: add extra check to avoid integer overflow
Diffstat (limited to 'lib')
-rw-r--r-- | lib/select.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/select.c b/lib/select.c index abf55d878..b9c110eb3 100644 --- a/lib/select.c +++ b/lib/select.c @@ -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 */ |