aboutsummaryrefslogtreecommitdiff
path: root/lib/socks.c
diff options
context:
space:
mode:
authorJay Satiro <raysatiro@yahoo.com>2020-04-07 17:18:05 -0400
committerJay Satiro <raysatiro@yahoo.com>2020-04-11 02:52:25 -0400
commit53f407082746e7e57534595957616b8d56905ad5 (patch)
tree8860303635fdff2c9ae4fc24f498e585eb7dbe06 /lib/socks.c
parent17c18fbc3015b5dc0580d16a4ff5bcf2fd88b449 (diff)
lib: fix conversion warnings for SOCKET_WRITABLE/READABLE
- If loss of data may occur converting a timediff_t to time_t and the time value is > TIME_T_MAX then treat it as TIME_T_MAX. This is a follow-up to 8843678 which removed the (time_t) typecast from the macros so that conversion warnings could be identified. Closes https://github.com/curl/curl/pull/5199
Diffstat (limited to 'lib/socks.c')
-rw-r--r--lib/socks.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/socks.c b/lib/socks.c
index 37099130e..5dd83631c 100644
--- a/lib/socks.c
+++ b/lib/socks.c
@@ -68,7 +68,9 @@ int Curl_blockread_all(struct connectdata *conn, /* connection data */
result = CURLE_OPERATION_TIMEDOUT;
break;
}
- if(SOCKET_READABLE(sockfd, timeleft) <= 0) {
+ if(timeleft > TIME_T_MAX)
+ timeleft = TIME_T_MAX;
+ if(SOCKET_READABLE(sockfd, (time_t)timeleft) <= 0) {
result = ~CURLE_OK;
break;
}