summaryrefslogtreecommitdiffstats
path: root/crypto/bn
diff options
context:
space:
mode:
authorKan <chenxinpingc2306@163.com>2021-12-17 00:35:32 +0800
committerPauli <pauli@openssl.org>2021-12-23 12:53:28 +1100
commita9c02a552153eabfb5a1a01ecdeb03e7b2920f4b (patch)
tree99868c5d76c6d5501fa4645c66eda760f7e12438 /crypto/bn
parent317bedd656e76b1162a6b29ed19a78303f362a78 (diff)
Add static check in BN_hex2bn
Fixes #17298 Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17299) (cherry picked from commit 7c78bd4be810ddceb8f13585a921946cc98f5fbd)
Diffstat (limited to 'crypto/bn')
-rw-r--r--crypto/bn/bn_conv.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/crypto/bn/bn_conv.c b/crypto/bn/bn_conv.c
index 6757f3d0aa..75054f5d6a 100644
--- a/crypto/bn/bn_conv.c
+++ b/crypto/bn/bn_conv.c
@@ -154,6 +154,10 @@ int BN_hex2bn(BIGNUM **bn, const char *a)
return 0;
} else {
ret = *bn;
+ if (BN_get_flags(ret, BN_FLG_STATIC_DATA)) {
+ ERR_raise(ERR_LIB_BN, ERR_R_PASSED_INVALID_ARGUMENT);
+ return 0;
+ }
BN_zero(ret);
}