aboutsummaryrefslogtreecommitdiffstats
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:57:21 +0000
commit625b0990a069a18917341e2f0fbe36327b0883b7 (patch)
tree3da36ca08c480eeb5d91d99e0cb15dfe2858be90
parent43ed2429566f27a2fb030316201c0c7af5a2b966 (diff)
downloadopenssl-625b0990a069a18917341e2f0fbe36327b0883b7.tar.gz
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)
-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 23d429622a..105a243b8e 100644
--- a/apps/s_client.c
+++ b/apps/s_client.c
@@ -1146,6 +1146,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 83feddca3e..2036d51795 100644
--- a/apps/s_server.c
+++ b/apps/s_server.c
@@ -1394,6 +1394,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