diff options
author | David Benjamin <davidben@chromium.org> | 2015-06-12 04:42:14 +0300 |
---|---|---|
committer | Adam Langley <agl@google.com> | 2015-06-15 20:52:40 +0300 |
commit | 1c703cb0c1e73d49af6bc837a7442f06a3dbcf08 (patch) | |
tree | 074de75247d9f774e282d439e5a438f644ead8b4 /crypto/bn/exponentiation.c | |
parent | 3a9e1fba0e3bcf014caa2df143a70475068447dc (diff) |
Check for BN_copy failures.
BN_copy can fail on malloc failure. The case in crypto/rsa was causing the
malloc tests in all_tests.go to infinite loop.
Change-Id: Id5900512013fba9960444d78a8c056aa4314fb2d
Reviewed-on: https://boringssl-review.googlesource.com/5110
Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'crypto/bn/exponentiation.c')
-rw-r--r-- | crypto/bn/exponentiation.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crypto/bn/exponentiation.c b/crypto/bn/exponentiation.c index d3063c9f..e0ea16e2 100644 --- a/crypto/bn/exponentiation.c +++ b/crypto/bn/exponentiation.c @@ -173,8 +173,8 @@ int BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) { } } - if (r != rr) { - BN_copy(r, rr); + if (r != rr && !BN_copy(r, rr)) { + goto err; } ret = 1; |