diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2016-11-05 15:21:21 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2016-11-05 15:21:21 +0000 |
commit | 634855ee12cbdf58bb29b7938837bce9cdb3602f (patch) | |
tree | 0725acb520fa4c58264a4959acb701ce7d132c80 | |
parent | 386f63b487ee78dc488b2ae9f056b54643e6e20f (diff) |
Check BIO_new*() for failure.
ok beck@ jsing@
-rw-r--r-- | lib/libcrypto/ocsp/ocsp_ht.c | 7 | ||||
-rw-r--r-- | lib/libcrypto/x509v3/pcy_tree.c | 6 |
2 files changed, 9 insertions, 4 deletions
diff --git a/lib/libcrypto/ocsp/ocsp_ht.c b/lib/libcrypto/ocsp/ocsp_ht.c index 4d21543396a..61af3717b78 100644 --- a/lib/libcrypto/ocsp/ocsp_ht.c +++ b/lib/libcrypto/ocsp/ocsp_ht.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ocsp_ht.c,v 1.22 2014/10/03 06:02:38 doug Exp $ */ +/* $OpenBSD: ocsp_ht.c,v 1.23 2016/11/05 15:21:20 miod Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2006. */ @@ -157,7 +157,10 @@ OCSP_sendreq_new(BIO *io, char *path, OCSP_REQUEST *req, int maxline) if (rctx == NULL) return NULL; rctx->state = OHS_ERROR; - rctx->mem = BIO_new(BIO_s_mem()); + if ((rctx->mem = BIO_new(BIO_s_mem())) == NULL) { + free(rctx); + return NULL; + } rctx->io = io; rctx->asn1_len = 0; if (maxline > 0) diff --git a/lib/libcrypto/x509v3/pcy_tree.c b/lib/libcrypto/x509v3/pcy_tree.c index 7b28acbe1f1..a56c183bc96 100644 --- a/lib/libcrypto/x509v3/pcy_tree.c +++ b/lib/libcrypto/x509v3/pcy_tree.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pcy_tree.c,v 1.16 2016/03/11 07:08:45 mmcc Exp $ */ +/* $OpenBSD: pcy_tree.c,v 1.17 2016/11/05 15:21:20 miod Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2004. */ @@ -99,7 +99,9 @@ tree_print(char *str, X509_POLICY_TREE *tree, X509_POLICY_LEVEL *curr) int i; BIO *err; - err = BIO_new_fp(stderr, BIO_NOCLOSE); + if ((err = BIO_new_fp(stderr, BIO_NOCLOSE)) == NULL) + return; + if (!curr) curr = tree->levels + tree->nlevel; else |