From: Fabian Keil Date: Sat, 30 Apr 2016 10:28:36 +0000 (+0000) Subject: parse_header_time(): Explicitly check for strftime() failures when sanity-checking... X-Git-Tag: v_3_0_25~58 X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=commitdiff_plain;h=2b98151ac62252d638c2c68e1f9db8bc897517ee parse_header_time(): Explicitly check for strftime() failures when sanity-checking strptime() --- diff --git a/parsers.c b/parsers.c index 64e69857..8e0ea457 100644 --- a/parsers.c +++ b/parsers.c @@ -1,4 +1,4 @@ -const char parsers_rcs[] = "$Id: parsers.c,v 1.307 2016/01/17 14:31:47 fabiankeil Exp $"; +const char parsers_rcs[] = "$Id: parsers.c,v 1.308 2016/02/26 12:31:12 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/parsers.c,v $ @@ -4313,7 +4313,13 @@ static jb_err parse_header_time(const char *header_time, time_t *result) time_t result2; tm = gmtime(result); - strftime(recreated_date, sizeof(recreated_date), time_formats[i], tm); + if (!strftime(recreated_date, sizeof(recreated_date), + time_formats[i], tm)) + { + log_error(LOG_LEVEL_ERROR, "Failed to recreate date '%s' with '%s'.", + header_time, time_formats[i]); + continue; + } memset(&gmt, 0, sizeof(gmt)); if (NULL == strptime(recreated_date, time_formats[i], &gmt)) {