Skip to content

Commit

Permalink
Fix error handling in bn_exp
Browse files Browse the repository at this point in the history
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 8c5a7b3)
  • Loading branch information
mattcaswell committed Mar 12, 2015
1 parent df57e42 commit 8944d10
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crypto/bn/bn_exp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 8944d10

Please sign in to comment.