From 0044443a020d15c262e9f6c724b29365a8148437 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 28 Nov 2019 15:27:58 +0100 Subject: parsedate: offer a getdate_capped() alternative ... and use internally. This function will return TIME_T_MAX instead of failure if the parsed data is found to be larger than what can be represented. TIME_T_MAX being the largest value curl can represent. Reviewed-by: Daniel Gustafsson Reported-by: JanB on github Fixes #4152 Closes #4651 --- lib/ftp.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'lib/ftp.c') diff --git a/lib/ftp.c b/lib/ftp.c index 8072a33d5..469096f0f 100644 --- a/lib/ftp.c +++ b/lib/ftp.c @@ -2039,13 +2039,11 @@ static CURLcode ftp_state_mdtm_resp(struct connectdata *conn, &year, &month, &day, &hour, &minute, &second)) { /* we have a time, reformat it */ char timebuf[24]; - time_t secs = time(NULL); - msnprintf(timebuf, sizeof(timebuf), "%04d%02d%02d %02d:%02d:%02d GMT", year, month, day, hour, minute, second); /* now, convert this into a time() value: */ - data->info.filetime = curl_getdate(timebuf, &secs); + data->info.filetime = Curl_getdate_capped(timebuf); } #ifdef CURL_FTP_HTTPSTYLE_HEAD -- cgit v1.2.3