From 152a689cf93f2bac78c1b0d6ee24c86640ae0f34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bodo=20M=C3=B6ller?= Date: Sun, 3 Dec 2000 09:39:04 +0000 Subject: Don't allow BIGNUMs to become so large that computations with dmax might overflow. --- crypto/bn/bn_lib.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'crypto/bn/bn_lib.c') diff --git a/crypto/bn/bn_lib.c b/crypto/bn/bn_lib.c index 050e02bd3a..096bcf1835 100644 --- a/crypto/bn/bn_lib.c +++ b/crypto/bn/bn_lib.c @@ -312,6 +312,12 @@ static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) const BN_ULONG *B; int i; + if (words > (INT_MAX/(4*BN_BITS2))) + { + BNerr(BN_F_BN_EXPAND_INTERNAL,BN_R_TOO_LARGE); + return NULL; + } + bn_check_top(b); if (BN_get_flags(b,BN_FLG_STATIC_DATA)) { -- cgit v1.2.3