From: Daniel Stenberg Date: Thu, 1 Feb 2018 21:23:20 +0000 (+0100) Subject: getdate: return -1 for out of range X-Git-Tag: curl-7_59_0~104 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a19afaccfeb5a77c15fdfc1c2be16fb27828cefc;p=curl 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 #2278 --- diff --git a/lib/parsedate.c b/lib/parsedate.c index beaa1bbd5..23a787fc9 100644 --- a/lib/parsedate.c +++ b/lib/parsedate.c @@ -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 */