From: Bodo Möller Date: Mon, 18 Sep 2006 14:00:49 +0000 (+0000) Subject: Ensure that the addition mods[i]+delta cannot overflow in probable_prime(). X-Git-Tag: OpenSSL_0_9_8k^2~1142 X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff_plain;h=a53cdc5b0834dd23072ea20e546d55ca4f43a0c8;ds=sidebyside Ensure that the addition mods[i]+delta cannot overflow in probable_prime(). [Problem pointed out by Adam Young ] --- diff --git a/crypto/bn/bn_prime.c b/crypto/bn/bn_prime.c index d57f658211..5bab019553 100644 --- a/crypto/bn/bn_prime.c +++ b/crypto/bn/bn_prime.c @@ -378,13 +378,14 @@ static int probable_prime(BIGNUM *rnd, int bits) { int i; BN_ULONG mods[NUMPRIMES]; - BN_ULONG delta,d; + BN_ULONG delta,maxdelta; again: if (!BN_rand(rnd,bits,1,1)) return(0); /* we now have a random number 'rand' to test. */ for (i=1; i maxdelta) goto again; goto loop; } }