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)
This commit is contained in:
xkernel 2022-03-07 15:43:16 +08:00 committed by Matt Caswell
parent 43ed242956
commit 625b0990a0
2 changed files with 8 additions and 0 deletions

View File

@ -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

View File

@ -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