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/parsedate.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/parsedate.h') diff --git a/lib/parsedate.h b/lib/parsedate.h index 83d4c1f24..8c7ae94e4 100644 --- a/lib/parsedate.h +++ b/lib/parsedate.h @@ -27,4 +27,10 @@ extern const char * const Curl_month[12]; CURLcode Curl_gmtime(time_t intime, struct tm *store); +/* Curl_getdate_capped() differs from curl_getdate() in that this will return + TIME_T_MAX in case the parsed time value was too big, instead of an + error. */ + +time_t Curl_getdate_capped(const char *p); + #endif /* HEADER_CURL_PARSEDATE_H */ -- cgit v1.2.3