From eea918a7732c97fdbf2b37461f50e3c53ba4f27d Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Fri, 4 Mar 2005 23:53:54 +0000 Subject: * 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 --- src/lib/krb5/asn.1/ChangeLog | 5 +++++ src/lib/krb5/asn.1/asn1_encode.c | 5 +++++ 2 files changed, 10 insertions(+) (limited to 'src/lib') diff --git a/src/lib/krb5/asn.1/ChangeLog b/src/lib/krb5/asn.1/ChangeLog index 4baf064f23..9d9d2bbc29 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 4f9e6949b5..c5e3452b85 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) -- cgit