From: Ken Raeburn Date: Fri, 4 Mar 2005 23:53:54 +0000 (+0000) Subject: * asn1_encode.c (asn1_encode_generaltime): If gmtime_r returns int instead of X-Git-Tag: ms-bug-test-20060525~321 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=eea918a7732c97fdbf2b37461f50e3c53ba4f27d;p=krb5.git * asn1_encode.c (asn1_encode_generaltime): If gmtime_r returns int instead of pointer, do the appropriate error checking. ticket: 2953 target_version: 1.4.1 tags: pullup git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17118 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/asn.1/ChangeLog b/src/lib/krb5/asn.1/ChangeLog index 4baf064f2..9d9d2bbc2 100644 --- a/src/lib/krb5/asn.1/ChangeLog +++ b/src/lib/krb5/asn.1/ChangeLog @@ -1,3 +1,8 @@ +2005-03-04 Ken Raeburn + + * asn1_encode.c (asn1_encode_generaltime): If gmtime_r returns int + instead of pointer, do the appropriate error checking. + 2004-12-28 Ezra Peisach * asn1_decode.c (asn1_decode_generaltime): Fix memory leak when diff --git a/src/lib/krb5/asn.1/asn1_encode.c b/src/lib/krb5/asn.1/asn1_encode.c index 4f9e6949b..c5e3452b8 100644 --- a/src/lib/krb5/asn.1/asn1_encode.c +++ b/src/lib/krb5/asn.1/asn1_encode.c @@ -242,8 +242,13 @@ asn1_error_code asn1_encode_generaltime(asn1buf *buf, time_t val, * and some bogus implementations might overrun on the sprintf. */ #ifdef HAVE_GMTIME_R +# ifdef GMTIME_R_RETURNS_INT + if (gmtime_r(&gmt_time, >imebuf) != 0) + return ASN1_BAD_GMTIME; +# else if (gmtime_r(&gmt_time, >imebuf) == NULL) return ASN1_BAD_GMTIME; +# endif #else gtime = gmtime(&gmt_time); if (gtime == NULL)