From 3ae4c52cbcd936e82ecb37ba1282ce98e5e4c14b Mon Sep 17 00:00:00 2001 From: Love Hornquist Astrand Date: Sat, 23 Apr 2011 19:57:14 -0700 Subject: [PATCH] make _der_gmtime pickier about times is willing to convert --- lib/asn1/timegm.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/asn1/timegm.c b/lib/asn1/timegm.c index b56947841..1b3b47fa5 100644 --- a/lib/asn1/timegm.c +++ b/lib/asn1/timegm.c @@ -98,6 +98,14 @@ _der_gmtime(time_t t, struct tm *tm) tm->tm_min = (secday % 3600) / 60; tm->tm_hour = secday / 3600; + /* + * Refuse to calculate time ~ 2000 years into the future, this is + * not possible for systems where time_t is a int32_t, however, + * when time_t is a int64_t, that can happen. + */ + if (days > 356000) + return NULL; + tm->tm_year = 70; while(1) { unsigned dayinyear = (is_leap(tm->tm_year) ? 366 : 365); -- 2.11.4.GIT