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