From 53f407082746e7e57534595957616b8d56905ad5 Mon Sep 17 00:00:00 2001 From: Jay Satiro Date: Tue, 7 Apr 2020 17:18:05 -0400 Subject: 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 --- lib/vtls/schannel.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/vtls') diff --git a/lib/vtls/schannel.c b/lib/vtls/schannel.c index 8bf598c07..cb70d5309 100644 --- a/lib/vtls/schannel.c +++ b/lib/vtls/schannel.c @@ -1645,8 +1645,9 @@ schannel_send(struct connectdata *conn, int sockindex, 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); -- cgit v1.2.3