Correct serious bug in AES-CBC decryption when the message length isn't
[openssl.git] / crypto / o_time.c
index 136ea567b7819d502996df3812a1a3985f3dc6fb..785468131e10f225305feb382643561363b80807 100644 (file)
@@ -1,5 +1,5 @@
 /* crypto/o_time.c -*- mode:C; c-file-style: "eay" -*- */
-/* Written by Richard Levitte (levitte@stacken.kth.se) for the OpenSSL
+/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL
  * project 2001.
  */
 /* ====================================================================
@@ -57,6 +57,7 @@
  */
 
 #include <openssl/e_os2.h>
+#include <string.h>
 #include "o_time.h"
 
 #ifdef OPENSSL_SYS_VMS
@@ -72,13 +73,16 @@ struct tm *OPENSSL_gmtime(const time_t *timer, struct tm *result)
        {
        struct tm *ts = NULL;
 
-#if defined(OPENSSL_THREADS) && !defined(OPENSSL_SYS_WIN32) && !defined(__CYGWIN32__) && (!defined(OPENSSL_SYS_VMS) || defined(gmtime_r))
+#if defined(OPENSSL_THREADS) && !defined(OPENSSL_SYS_WIN32) && !defined(OPENSSL_SYS_OS2) && !defined(__CYGWIN32__) && (!defined(OPENSSL_SYS_VMS) || defined(gmtime_r)) && !defined(OPENSSL_SYS_MACOSX) && !defined(OPENSSL_SYS_SUNOS)
        /* should return &data, but doesn't on some systems,
           so we don't even look at the return value */
        gmtime_r(timer,result);
        ts = result;
 #elif !defined(OPENSSL_SYS_VMS)
        ts = gmtime(timer);
+       if (ts == NULL)
+               return NULL;
+
        memcpy(result, ts, sizeof(struct tm));
        ts = result;
 #endif