Fix memory leak in BN_rand_range()
authorvaldaarhun <icegambit91@gmail.com>
Wed, 10 Aug 2022 19:18:05 +0000 (00:48 +0530)
committerTomas Mraz <tomas@openssl.org>
Wed, 17 Aug 2022 16:42:58 +0000 (18:42 +0200)
commit682d4a1204bc0a4c19ad3dd23f09d1e76959f8cf
tree84dc97b441c015caa6d0c249e184807a65b4acab
parent0f0634bc8cf8a6d82a2110a6e983cf92032115c9
Fix memory leak in BN_rand_range()

The patch enables BN_rand_range() to exit immediately
if BIGNUM *rnd is NULL.

CLA: trivial

Fixes: #18951
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18982)

(cherry picked from commit 70f589ae41928edda18470ba1c3df82af02a92b3)
crypto/bn/bn_rand.c