summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2021-01-22 15:56:17 +0000
committertb <>2021-01-22 15:56:17 +0000
commitd5626382a55396240f1722a5e5fae881c70598d2 (patch)
tree659046d744bcc8ce7300485b1c43ca6c50ae5bfa /src
parentc03d37dd49716682d1a37b81c9af857acf4895cb (diff)
downloadopenbsd-d5626382a55396240f1722a5e5fae881c70598d2.tar.gz
openbsd-d5626382a55396240f1722a5e5fae881c70598d2.tar.bz2
openbsd-d5626382a55396240f1722a5e5fae881c70598d2.zip
Avoid NULL deref on BIO_new{_mem_buf,}() failure.
Diffstat (limited to 'src')
-rw-r--r--src/regress/lib/libssl/client/clienttest.c8
-rw-r--r--src/regress/lib/libssl/server/servertest.c10
2 files changed, 11 insertions, 7 deletions
diff --git a/src/regress/lib/libssl/client/clienttest.c b/src/regress/lib/libssl/client/clienttest.c
index be9ebc1d30..51b23986fd 100644
--- a/src/regress/lib/libssl/client/clienttest.c
+++ b/src/regress/lib/libssl/client/clienttest.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: clienttest.c,v 1.26 2020/11/19 09:35:50 tb Exp $ */ 1/* $OpenBSD: clienttest.c,v 1.27 2021/01/22 15:54:32 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2015 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2015 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -456,8 +456,10 @@ client_hello_test(int testno, struct client_hello_test *cht)
456 SSL_CTX_free(ssl_ctx); 456 SSL_CTX_free(ssl_ctx);
457 SSL_free(ssl); 457 SSL_free(ssl);
458 458
459 rbio->references = 1; 459 if (rbio != NULL)
460 wbio->references = 1; 460 rbio->references = 1;
461 if (wbio != NULL)
462 wbio->references = 1;
461 463
462 BIO_free(rbio); 464 BIO_free(rbio);
463 BIO_free(wbio); 465 BIO_free(wbio);
diff --git a/src/regress/lib/libssl/server/servertest.c b/src/regress/lib/libssl/server/servertest.c
index d6f2039af1..a71c5f8c66 100644
--- a/src/regress/lib/libssl/server/servertest.c
+++ b/src/regress/lib/libssl/server/servertest.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: servertest.c,v 1.4 2020/10/11 02:30:04 jsing Exp $ */ 1/* $OpenBSD: servertest.c,v 1.5 2021/01/22 15:56:17 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2015, 2016, 2017 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2015, 2016, 2017 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -159,7 +159,7 @@ server_hello_test(int testno, struct server_hello_test *sht)
159 wbio->references = 2; 159 wbio->references = 2;
160 160
161 SSL_set_bio(ssl, rbio, wbio); 161 SSL_set_bio(ssl, rbio, wbio);
162 162
163 if (SSL_accept(ssl) != 0) { 163 if (SSL_accept(ssl) != 0) {
164 fprintf(stderr, "SSL_accept() returned non-zero\n"); 164 fprintf(stderr, "SSL_accept() returned non-zero\n");
165 ERR_print_errors_fp(stderr); 165 ERR_print_errors_fp(stderr);
@@ -172,8 +172,10 @@ server_hello_test(int testno, struct server_hello_test *sht)
172 SSL_CTX_free(ssl_ctx); 172 SSL_CTX_free(ssl_ctx);
173 SSL_free(ssl); 173 SSL_free(ssl);
174 174
175 rbio->references = 1; 175 if (rbio != NULL)
176 wbio->references = 1; 176 rbio->references = 1;
177 if (wbio != NULL)
178 wbio->references = 1;
177 179
178 BIO_free(rbio); 180 BIO_free(rbio);
179 BIO_free(wbio); 181 BIO_free(wbio);