Don't allow BIGNUMs to become so large that computations with dmax

might overflow.
This commit is contained in:
Bodo Möller
2000-12-03 09:37:15 +00:00
parent 99cf5acd5c
commit fe772376ec
3 changed files with 8 additions and 0 deletions

View File

@@ -319,6 +319,12 @@ BIGNUM *bn_expand2(BIGNUM *b, int words)
if (words > b->dmax)
{
if (words > (INT_MAX/(4*BN_BITS2)))
{
BNerr(BN_F_BN_EXPAND2,BN_R_TOO_LARGE);
return NULL;
}
bn_check_top(b);
if (BN_get_flags(b,BN_FLG_STATIC_DATA))
{