From: Werner Koch Date: Mon, 30 Apr 2012 15:46:15 +0000 (+0200) Subject: Fix timestamp parsing for y2038 hack. X-Git-Tag: gpgme-1.3.2~4 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=1a21574b48ee91eedbf95251ee600648b377d1e7;p=gpgme.git Fix timestamp parsing for y2038 hack. * src/conversion.c (_gpgme_parse_timestamp): Set ENDP before year 2038 check. --- 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