1
0
mirror of https://github.com/moparisthebest/curl synced 2024-08-13 17:03:50 -04:00

get_posix_time: only check for overflows if they can happen!

This commit is contained in:
Daniel Stenberg 2018-02-09 14:29:03 +01:00
parent 1c680e35ab
commit 23722c515f
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -716,11 +716,13 @@ static void get_posix_time(time_t *out, curl_off_t timestamp)
{
timestamp -= 116444736000000000;
timestamp /= 10000000;
#if SIZEOF_TIME_T < SIZEOF_CURL_OFF_T
if(timestamp > TIME_T_MAX)
*out = TIME_T_MAX;
else if(timestamp < TIME_T_MIN)
*out = TIME_T_MIN;
else
#endif
*out = (time_t) timestamp;
}