The branch openssl-3.0 has been updated via d05340770a9cdc6acfe7d4d3a8acbe1165a100ee (commit) from 20ca6f0ad1d621f7cd2b939b7e2e58ba29df2e08 (commit)
- Log ----------------------------------------------------------------- commit d05340770a9cdc6acfe7d4d3a8acbe1165a100ee Author: Peiwei Hu <jlu....@foxmail.com> Date: Mon Nov 15 00:41:21 2021 +0800 BIO_read_filename: fix return check Reviewed-by: Matt Caswell <m...@openssl.org> Reviewed-by: Paul Dale <pa...@openssl.org> Reviewed-by: Tomas Mraz <to...@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17033) (cherry picked from commit e3f0362407f6f40e413d6dcb35888514dbaed6f8) ----------------------------------------------------------------------- Summary of changes: ssl/ssl_cert.c | 4 ++-- test/sslapitest.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ssl/ssl_cert.c b/ssl/ssl_cert.c index 547e9b9ccd..34351c161c 100644 --- a/ssl/ssl_cert.c +++ b/ssl/ssl_cert.c @@ -625,7 +625,7 @@ STACK_OF(X509_NAME) *SSL_load_client_CA_file_ex(const char *file, ERR_raise(ERR_LIB_SSL, ERR_R_MALLOC_FAILURE); goto err; } - if (!BIO_read_filename(in, file)) + if (BIO_read_filename(in, file) <= 0) goto err; /* Internally lh_X509_NAME_retrieve() needs the libctx to retrieve SHA1 */ @@ -696,7 +696,7 @@ int SSL_add_file_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack, goto err; } - if (!BIO_read_filename(in, file)) + if (BIO_read_filename(in, file) <= 0) goto err; for (;;) { diff --git a/test/sslapitest.c b/test/sslapitest.c index 3257e1ee36..4017d47a77 100644 --- a/test/sslapitest.c +++ b/test/sslapitest.c @@ -7978,7 +7978,7 @@ static int cert_cb(SSL *s, void *arg) if (!TEST_ptr(chain)) goto out; if (!TEST_ptr(in = BIO_new(BIO_s_file())) - || !TEST_int_ge(BIO_read_filename(in, rootfile), 0) + || !TEST_int_gt(BIO_read_filename(in, rootfile), 0) || !TEST_ptr(rootx = X509_new_ex(libctx, NULL)) || !TEST_ptr(PEM_read_bio_X509(in, &rootx, NULL, NULL)) || !TEST_true(sk_X509_push(chain, rootx))) @@ -7986,13 +7986,13 @@ static int cert_cb(SSL *s, void *arg) rootx = NULL; BIO_free(in); if (!TEST_ptr(in = BIO_new(BIO_s_file())) - || !TEST_int_ge(BIO_read_filename(in, ecdsacert), 0) + || !TEST_int_gt(BIO_read_filename(in, ecdsacert), 0) || !TEST_ptr(x509 = X509_new_ex(libctx, NULL)) || !TEST_ptr(PEM_read_bio_X509(in, &x509, NULL, NULL))) goto out; BIO_free(in); if (!TEST_ptr(in = BIO_new(BIO_s_file())) - || !TEST_int_ge(BIO_read_filename(in, ecdsakey), 0) + || !TEST_int_gt(BIO_read_filename(in, ecdsakey), 0) || !TEST_ptr(pkey = PEM_read_bio_PrivateKey_ex(in, NULL, NULL, NULL, libctx, NULL)))