diff options
author | Jiasheng Jiang <jiasheng@iscas.ac.cn> | 2022-02-21 10:10:23 +0800 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2022-02-28 12:17:17 +0100 |
commit | 445925de2f8064328c76145190b403c3c1dd8d0f (patch) | |
tree | 605c3b810371c7137b84f4b3de0a6d5081c55d63 /fuzz | |
parent | 412403e9dca9c6391f957c92b54777767a9bca21 (diff) |
fuzz/fuzz_rand.c: Add check for OSSL_LIB_CTX_new
As the potential failure of the OPENSSL_zalloc(), the OSSL_LIB_CTX_new()
could return NULL.
Therefore, it should be better to check it and return error if fails in
order to guarantee the success of the initialization.
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17738)
(cherry picked from commit 885d97fbf84fb9de7548a5f6d4e90798f719022a)
Diffstat (limited to 'fuzz')
-rw-r--r-- | fuzz/fuzz_rand.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fuzz/fuzz_rand.c b/fuzz/fuzz_rand.c index 5bd343d8ae..d71dfd7a3c 100644 --- a/fuzz/fuzz_rand.c +++ b/fuzz/fuzz_rand.c @@ -146,6 +146,8 @@ static int fuzz_rand_provider_init(const OSSL_CORE_HANDLE *handle, const OSSL_DISPATCH **out, void **provctx) { *provctx = OSSL_LIB_CTX_new(); + if (*provctx == NULL) + return 0; *out = fuzz_rand_method; return 1; } |