- 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
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;
}
written = -1;
break;
}
-
- what = SOCKET_WRITABLE(conn->sock[sockindex], timeleft);
+ if(timeleft > TIME_T_MAX)
+ timeleft = TIME_T_MAX;
+ what = SOCKET_WRITABLE(conn->sock[sockindex], (time_t)timeleft);
if(what < 0) {
/* fatal error */
failf(conn->data, "select/poll on SSL socket, errno: %d", SOCKERRNO);