summaryrefslogtreecommitdiff
path: root/lib/parsedate.c
diff options
context:
space:
mode:
authorMarc Hoersken <info@marc-hoersken.de>2014-04-19 15:47:07 +0200
committerMarc Hoersken <info@marc-hoersken.de>2014-04-19 15:47:07 +0200
commit9146f379731e974af1a387c81f6859a072504d68 (patch)
treea0f5b4fba58d63a4fb77a610aceb241f9a77f47c /lib/parsedate.c
parent662fc625177208896ce707c5e39ea58d9936cb84 (diff)
downloadcurl-9146f379731e974af1a387c81f6859a072504d68.tar.gz
parsedate.c: check sscanf result before passing it to strlen
Diffstat (limited to 'lib/parsedate.c')
-rw-r--r--lib/parsedate.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/parsedate.c b/lib/parsedate.c
index c4f0f4516..d7942f554 100644
--- a/lib/parsedate.c
+++ b/lib/parsedate.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, 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);