diff options
author | Matt Caswell <matt@openssl.org> | 2023-08-11 11:51:15 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2023-08-14 14:32:06 +0100 |
commit | 69b9a992961c27ac6d0f0bec259806ac953a81d4 (patch) | |
tree | bd2d6f991cf3efd0334826ba9aeba9c87a0edf53 | |
parent | f2609004df4d91a365338e11d04ff67589f2d3e3 (diff) | |
download | openssl-69b9a992961c27ac6d0f0bec259806ac953a81d4.tar.gz |
Don't call ossl_assert on the result of bn_wexpand
bn_wexpand can fail as the result of a memory allocation failure. We
should not be calling ossl_assert() on its result because it can fail in
normal operation.
Found via the reproducible error injection in #21668
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/21725)
-rw-r--r-- | crypto/bn/bn_lib.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/bn/bn_lib.c b/crypto/bn/bn_lib.c index e810647f57..1b8d47a281 100644 --- a/crypto/bn/bn_lib.c +++ b/crypto/bn/bn_lib.c @@ -504,7 +504,7 @@ static BIGNUM *bin2bn(const unsigned char *s, int len, BIGNUM *ret, return ret; } n = ((len - 1) / BN_BYTES) + 1; /* Number of resulting bignum chunks */ - if (!ossl_assert(bn_wexpand(ret, (int)n) != NULL)) { + if (bn_wexpand(ret, (int)n) == NULL) { BN_free(bn); return NULL; } |