From 87a0afed5db7e916a6ad6715e14996b2e25641d7 Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Wed, 27 Mar 2013 17:54:38 +0100 Subject: Don't try to guess at overflowing time values on 32-bit systems Since CKA_START_DATE and CKA_END_DATE are the only places where we want to parse out times, and these are optional, just leave blank if the time overflows what libc can handle on a 32-bit system. https://bugs.freedesktop.org/show_bug.cgi?id=62825 --- common/asn1.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'common') diff --git a/common/asn1.c b/common/asn1.c index 44f96eb..c98d959 100644 --- a/common/asn1.c +++ b/common/asn1.c @@ -469,9 +469,9 @@ when_and_offset_to_time_t (struct tm *when, { time_t timet; - /* In order to work with 32 bit time_t. */ - if (sizeof (time_t) <= 4 && when->tm_year >= 2038) { - timet = (time_t)2145914603; /* 2037-12-31 23:23:23 */ + /* A 32-bit time, cannot represent this time */ + if (sizeof (time_t) <= 4 && when->tm_year >= 138) { + return -1; /* Convert to seconds since epoch */ } else { -- cgit v1.1