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 <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1613)
This commit is contained in:
Guido Vranken 2016-09-22 22:48:44 +02:00 committed by Rich Salz
parent 57b0d651f0
commit 873019f2c3

View File

@ -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);