The branch master has been updated via 52dcc011191ad1a40fd52ae92ef009309deaca52 (commit) from 6923d261b819cdd5d9e0a72337da6d6a92cef2a2 (commit)
- Log ----------------------------------------------------------------- commit 52dcc011191ad1a40fd52ae92ef009309deaca52 Author: Dmitry Belyavskiy <beld...@gmail.com> Date: Mon Sep 20 16:35:10 2021 +0200 Avoid double-free on unsuccessful getting PRNG seeding Fixes #16631 Reviewed-by: Paul Dale <pa...@openssl.org> Reviewed-by: Tomas Mraz <to...@openssl.org> (Merged from https://github.com/openssl/openssl/pull/16636) ----------------------------------------------------------------------- Summary of changes: providers/implementations/rands/seed_src.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/providers/implementations/rands/seed_src.c b/providers/implementations/rands/seed_src.c index 173c99ce17..7a4b780bb4 100644 --- a/providers/implementations/rands/seed_src.c +++ b/providers/implementations/rands/seed_src.c @@ -201,10 +201,11 @@ static size_t seed_get_seed(void *vseed, unsigned char **pout, ERR_raise(ERR_LIB_PROV, ERR_R_MALLOC_FAILURE); return 0; } - *pout = p; if (seed_src_generate(vseed, p, bytes_needed, 0, prediction_resistance, - adin, adin_len) != 0) + adin, adin_len) != 0) { + *pout = p; return bytes_needed; + } OPENSSL_secure_clear_free(p, bytes_needed); return 0; }