Fix error handling in bn_exp

In the event of an error |rr| could be NULL. Therefore don't assume you can
use |rr| in the error handling code.

Reviewed-by: Andy Polyakov <appro@openssl.org>
(cherry picked from commit 8c5a7b33c6)
This commit is contained in:
Matt Caswell 2015-03-11 15:31:16 +00:00
parent df57e42baa
commit 8944d10e2d

View File

@ -185,10 +185,10 @@ int BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
goto err;
}
}
ret = 1;
err:
if (r != rr)
BN_copy(r, rr);
ret = 1;
err:
BN_CTX_end(ctx);
bn_check_top(r);
return (ret);