* asn1_encode.c (asn1_encode_generaltime): If gmtime_r returns int instead of
authorKen Raeburn <raeburn@mit.edu>
Fri, 4 Mar 2005 23:53:54 +0000 (23:53 +0000)
committerKen Raeburn <raeburn@mit.edu>
Fri, 4 Mar 2005 23:53:54 +0000 (23:53 +0000)
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
src/lib/krb5/asn.1/asn1_encode.c

index 4baf064f23225164e6b75a0aa09581f9001914c5..9d9d2bbc29c88958ffa4e5e5faa1ac91942c75ca 100644 (file)
@@ -1,3 +1,8 @@
+2005-03-04  Ken Raeburn  <raeburn@mit.edu>
+
+       * asn1_encode.c (asn1_encode_generaltime): If gmtime_r returns int
+       instead of pointer, do the appropriate error checking.
+
 2004-12-28  Ezra Peisach  <epeisach@mit.edu>
 
        * asn1_decode.c (asn1_decode_generaltime): Fix memory leak when
index 4f9e6949b53370830807d11934ffd7741e3e38f6..c5e3452b8575d4ab9349fbbbf0f87e2a872012b8 100644 (file)
@@ -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, &gtimebuf) != 0)
+         return ASN1_BAD_GMTIME;
+# else
       if (gmtime_r(&gmt_time, &gtimebuf) == NULL)
          return ASN1_BAD_GMTIME;
+# endif
 #else
       gtime = gmtime(&gmt_time);
       if (gtime == NULL)