From 873019f2c3d5d19f761b0f6e8dbc8d439345fd6f Mon Sep 17 00:00:00 2001 From: Guido Vranken Date: Thu, 22 Sep 2016 22:48:44 +0200 Subject: [PATCH] Prevents that OPENSSL_gmtime incorrectly signals success if gmtime_r fails, and that struct* tm result's possibly uninitialized content is used Reviewed-by: Richard Levitte Reviewed-by: Rich Salz (Merged from https://github.com/openssl/openssl/pull/1613) --- crypto/o_time.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crypto/o_time.c b/crypto/o_time.c index e785525b3f..bf74150f33 100755 --- a/crypto/o_time.c +++ b/crypto/o_time.c @@ -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); -- 2.25.1