Submitted by: Peter Gutmann <pgut001@cs.auckland.ac.nz>
[openssl.git] / crypto / bn / bn_div.c
index 6db472f8c321ec162433577540ad73e084be2d3f..899d07ca2420e208ca893e52bf8ce46138744313 100644 (file)
@@ -229,7 +229,8 @@ int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
        if (dv == NULL)
                res=BN_CTX_get(ctx);
        else    res=dv;
-       if (sdiv == NULL || res == NULL) goto err;
+       if (sdiv == NULL || res == NULL || tmp == NULL || snum == NULL)
+               goto err;
 
        /* First we normalise the numbers */
        norm_shift=BN_BITS2-((BN_num_bits(divisor))%BN_BITS2);