summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2016-11-05 15:21:20 +0000
committermiod <miod@openbsd.org>2016-11-05 15:21:20 +0000
commit7f3aaf75af7d394257f7a8a02fe172b6ae48a248 (patch)
tree6629d496b566c95b0a09737d77c25fd3efd8ffcd /lib
parentMore X509_STORE_CTX_set_*() return value checks. (diff)
downloadwireguard-openbsd-7f3aaf75af7d394257f7a8a02fe172b6ae48a248.tar.xz
wireguard-openbsd-7f3aaf75af7d394257f7a8a02fe172b6ae48a248.zip
Check BIO_new*() for failure.
ok beck@ jsing@
Diffstat (limited to 'lib')
-rw-r--r--lib/libcrypto/ocsp/ocsp_ht.c7
-rw-r--r--lib/libcrypto/x509v3/pcy_tree.c6
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