diff options
author | levitte <levitte> | 2002-05-30 16:47:21 +0000 |
---|---|---|
committer | levitte <levitte> | 2002-05-30 16:47:21 +0000 |
commit | 7ce6d75ae8dad313bf150305ebb72f55a8fa23a9 (patch) | |
tree | ef2cdf5281f81cd0875b48b12ab6e3430a271990 /crypto/bn/bn_div.c | |
parent | 34b4589abffc111e3640b55cb95578cd185896c2 (diff) | |
download | openssl-7ce6d75ae8dad313bf150305ebb72f55a8fa23a9.tar.gz |
Check the return values where memory allocation failures may happen.
PR: 49
Diffstat (limited to 'crypto/bn/bn_div.c')
-rw-r--r-- | crypto/bn/bn_div.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/crypto/bn/bn_div.c b/crypto/bn/bn_div.c index ac1a09615..f9a095e3b 100644 --- a/crypto/bn/bn_div.c +++ b/crypto/bn/bn_div.c @@ -200,10 +200,10 @@ int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, /* First we normalise the numbers */ norm_shift=BN_BITS2-((BN_num_bits(divisor))%BN_BITS2); - BN_lshift(sdiv,divisor,norm_shift); + if (!(BN_lshift(sdiv,divisor,norm_shift))) goto err; sdiv->neg=0; norm_shift+=BN_BITS2; - BN_lshift(snum,num,norm_shift); + if (!(BN_lshift(snum,num,norm_shift))) goto err; snum->neg=0; div_n=sdiv->top; num_n=snum->top; @@ -327,7 +327,7 @@ int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, tmp->top=j; j=wnum.top; - BN_sub(&wnum,&wnum,tmp); + if (!BN_sub(&wnum,&wnum,tmp)) goto err; snum->top=snum->top+wnum.top-j; @@ -335,7 +335,7 @@ int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, { q--; j=wnum.top; - BN_add(&wnum,&wnum,sdiv); + if (!BN_add(&wnum,&wnum,sdiv)) goto err; snum->top+=wnum.top-j; } *(resp--)=q; |