Prevents that OPENSSL_gmtime incorrectly signals success if gmtime_r fails, and that...
authorGuido Vranken <guidovranken@gmail.com>
Thu, 22 Sep 2016 20:48:44 +0000 (22:48 +0200)
committerRich Salz <rsalz@openssl.org>
Tue, 14 Feb 2017 19:52:24 +0000 (14:52 -0500)
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1613)

crypto/o_time.c

index e785525b3f9b86baff33879de6a8ec29027a278a..bf74150f33f47d6888a7336f225c2f97da6bf2a2 100755 (executable)
@@ -56,7 +56,8 @@ struct tm *OPENSSL_gmtime(const time_t *timer, struct tm *result)
      * should return &data, but doesn't on some systems, so we don't even
      * look at the return value
      */
-    gmtime_r(timer, result);
+    if (gmtime_r(timer, result) == NULL)
+        return NULL;
     ts = result;
 #elif !defined(OPENSSL_SYS_VMS) || defined(VMS_GMTIME_OK)
     ts = gmtime(timer);