Unverified Commit a19afacc authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

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
parent 1eb4f5ac
Loading
Loading
Loading
Loading
+1 −5
Original line number Diff line number Diff line
@@ -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 */