summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxkernel <xkernel.wang@foxmail.com>2022-03-07 15:43:16 +0800
committerMatt Caswell <matt@openssl.org>2022-03-10 13:59:18 +0000
commit5225a3ddc61e956a978c04cfef390ddfae3b5d1e (patch)
tree476f079e5c0f32c28a689c9ae418e713f4aac2b1
parent247d9dbeb973c1bd5f139862f8bb44e1fc5abb7d (diff)
check the return value of BIO_new_file()
Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17820) (cherry picked from commit 625b0990a069a18917341e2f0fbe36327b0883b7)
-rw-r--r--apps/s_client.c4
-rw-r--r--apps/s_server.c4
2 files changed, 8 insertions, 0 deletions
diff --git a/apps/s_client.c b/apps/s_client.c
index e16f539e46..1bde77fd2a 100644
--- a/apps/s_client.c
+++ b/apps/s_client.c
@@ -1133,6 +1133,10 @@ int s_client_main(int argc, char **argv)
break;
case OPT_MSGFILE:
bio_c_msg = BIO_new_file(opt_arg(), "w");
+ if (bio_c_msg == NULL) {
+ BIO_printf(bio_err, "Error writing file %s\n", opt_arg());
+ goto end;
+ }
break;
case OPT_TRACE:
#ifndef OPENSSL_NO_SSL_TRACE
diff --git a/apps/s_server.c b/apps/s_server.c
index acf577180a..c2d121362a 100644
--- a/apps/s_server.c
+++ b/apps/s_server.c
@@ -1390,6 +1390,10 @@ int s_server_main(int argc, char *argv[])
break;
case OPT_MSGFILE:
bio_s_msg = BIO_new_file(opt_arg(), "w");
+ if (bio_s_msg == NULL) {
+ BIO_printf(bio_err, "Error writing file %s\n", opt_arg());
+ goto end;
+ }
break;
case OPT_TRACE:
#ifndef OPENSSL_NO_SSL_TRACE