cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl_getdate

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 21 Jun 2011 22:03:28 +0200 (CEST)

On Sun, 19 Jun 2011, Daniel Stenberg wrote:

> That seems a bit too liberal in what it accepts. You up to providing a
> patch?

How about simply doing this?

diff --git a/lib/parsedate.c b/lib/parsedate.c
index 6865f8e..457d1e3 100644
--- a/lib/parsedate.c
+++ b/lib/parsedate.c
@@ -485,6 +485,10 @@ static int parsedate(const char *date, time_t *output)
      return PARSEDATE_SOONER;
    }

+ if((mdaynum > 31) || (monnum > 11) ||
+ (hournum > 23) || (minnum > 59) || (secnum > 59))
+ return PARSEDATE_FAIL; /* clearly an illegal date */
+
    tm.tm_sec = secnum;
    tm.tm_min = minnum;
    tm.tm_hour = hournum;

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2011-06-21