From: Marc Hoersken Date: Sat, 19 Apr 2014 13:47:07 +0000 (+0200) Subject: parsedate.c: check sscanf result before passing it to strlen X-Git-Tag: curl-7_37_0~131 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9146f379731e974af1a387c81f6859a072504d68;p=thirdparty%2Fcurl.git parsedate.c: check sscanf result before passing it to strlen --- diff --git a/lib/parsedate.c b/lib/parsedate.c index c4f0f45166..d7942f5542 100644 --- a/lib/parsedate.c +++ b/lib/parsedate.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2013, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2014, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -353,9 +353,11 @@ static int parsedate(const char *date, time_t *output) /* a name coming up */ char buf[32]=""; size_t len; - sscanf(date, "%31[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz]", - buf); - len = strlen(buf); + if(sscanf(date, "%31[ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz]", buf)) + len = strlen(buf); + else + len = 0; if(wdaynum == -1) { wdaynum = checkday(buf, len);