diff options
author | Dan Fandrich <dan@coneharvesters.com> | 2014-08-05 08:50:30 +0200 |
---|---|---|
committer | Dan Fandrich <dan@coneharvesters.com> | 2014-08-05 09:25:47 +0200 |
commit | 5b37db44a3ebe63c49bb94b68eb919047ad94fb0 (patch) | |
tree | 85264f811bffcfa67f3f2c4d8499e4c5078c445d /lib/parsedate.c | |
parent | 0e452a02f1583b0d3ef86aaeb73fc665f3a8f6c0 (diff) | |
download | curl-5b37db44a3ebe63c49bb94b68eb919047ad94fb0.tar.gz |
parsedate.c: fix the return code for an overflow edge condition
Diffstat (limited to 'lib/parsedate.c')
-rw-r--r-- | lib/parsedate.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/parsedate.c b/lib/parsedate.c index d7942f554..ecb8dfb42 100644 --- a/lib/parsedate.c +++ b/lib/parsedate.c @@ -530,8 +530,10 @@ static int parsedate(const char *date, time_t *output) /* Add the time zone diff between local time zone and GMT. */ long delta = (long)(tzoff!=-1?tzoff:0); - if((delta>0) && (t > LONG_MAX - delta)) - return -1; /* time_t overflow */ + if((delta>0) && (t > LONG_MAX - delta)) { + *output = 0x7fffffff; + return PARSEDATE_LATER; /* time_t overflow */ + } t += delta; } @@ -561,9 +563,6 @@ time_t curl_getdate(const char *p, const time_t *now) * Curl_gmtime() is a gmtime() replacement for portability. Do not use the * gmtime_r() or gmtime() functions anywhere else but here. * - * To make sure no such function calls slip in, we define them to cause build - * errors, which is why we use the name within parentheses in this function. - * */ CURLcode Curl_gmtime(time_t intime, struct tm *store) |