2
0
mirror of https://github.com/curl/curl.git synced 2025-04-24 16:40:32 +08:00

getdate: return -1 for out of range

...as that's how the function is documented to work.

Reported-by: Michael Kaufmann
Bug found in an autobuild with 32 bit time_t

Closes 
This commit is contained in:
Daniel Stenberg 2018-02-01 22:23:20 +01:00
parent 1eb4f5ac9d
commit a19afaccfe
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

@ -561,14 +561,10 @@ time_t curl_getdate(const char *p, const time_t *now)
int rc = parsedate(p, &parsed);
(void)now; /* legacy argument from the past that we ignore */
switch(rc) {
case PARSEDATE_OK:
if(rc == PARSEDATE_OK) {
if(parsed == -1)
/* avoid returning -1 for a working scenario */
parsed++;
/* fallthrough */
case PARSEDATE_LATER:
case PARSEDATE_SOONER:
return parsed;
}
/* everything else is fail */