From 1a21574b48ee91eedbf95251ee600648b377d1e7 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Mon, 30 Apr 2012 17:46:15 +0200 Subject: [PATCH] Fix timestamp parsing for y2038 hack. * src/conversion.c (_gpgme_parse_timestamp): Set ENDP before year 2038 check. --- src/conversion.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/conversion.c b/src/conversion.c index d585b5a..356200c 100644 --- a/src/conversion.c +++ b/src/conversion.c @@ -374,6 +374,9 @@ _gpgme_parse_timestamp (const char *timestamp, char **endp) if (year < 1900) return (time_t)(-1); + if (endp) + *endp = (char*)(timestamp + 15); + /* Fixme: We would better use a configure test to see whether mktime can handle dates beyond 2038. */ if (sizeof (time_t) <= 4 && year >= 2038) @@ -387,8 +390,6 @@ _gpgme_parse_timestamp (const char *timestamp, char **endp) buf.tm_min = atoi_2 (timestamp+11); buf.tm_sec = atoi_2 (timestamp+13); - if (endp) - *endp = (char*)(timestamp + 15); #ifdef HAVE_W32_SYSTEM return _gpgme_timegm (&buf); #else -- 2.26.2