From: Guido Vranken Date: Thu, 22 Sep 2016 20:48:44 +0000 (+0200) Subject: Prevents that OPENSSL_gmtime incorrectly signals success if gmtime_r fails, and that... X-Git-Tag: OpenSSL_1_1_1-pre1~2402 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=873019f2c3d5d19f761b0f6e8dbc8d439345fd6f;p=oweals%2Fopenssl.git 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) --- 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);