Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/boringssl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Benjamin <davidben@chromium.org>2015-09-17 20:46:22 +0300
committerAdam Langley <agl@google.com>2015-09-18 22:30:09 +0300
commit306ece31bcaaed49e0240a2e5555f8901ebb2d45 (patch)
tree1a4eef595e0484146c5052bfe726d9ece03c236b /crypto/digest
parentc71567dd50b1915ce3a72be0d63ad598d06f4879 (diff)
Fix some malloc failure crashes.
EVP_MD_CTX_copy_ex was implemented with a memcpy, which doesn't work well when some of the pointers need to be copied, and ssl_verify_cert_chain didn't account for set_ex_data failing. Change-Id: Ieb556aeda6ab2e4c810f27012fefb1e65f860023 Reviewed-on: https://boringssl-review.googlesource.com/5911 Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'crypto/digest')
-rw-r--r--crypto/digest/digest.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/crypto/digest/digest.c b/crypto/digest/digest.c
index ada11667..eb71b073 100644
--- a/crypto/digest/digest.c
+++ b/crypto/digest/digest.c
@@ -129,8 +129,8 @@ int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in) {
}
EVP_MD_CTX_cleanup(out);
- memcpy(out, in, sizeof(EVP_MD_CTX));
+ out->digest = in->digest;
if (in->md_data && in->digest->ctx_size) {
if (tmp_buf) {
out->md_data = tmp_buf;
@@ -145,6 +145,7 @@ int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in) {
}
assert(in->pctx == NULL || in->pctx_ops != NULL);
+ out->pctx_ops = in->pctx_ops;
if (in->pctx && in->pctx_ops) {
out->pctx = in->pctx_ops->dup(in->pctx);
if (!out->pctx) {