[openssl] master update

tomas at openssl.org tomas at openssl.org
Tue Nov 16 16:34:30 UTC 2021


The branch master has been updated
       via  e3f0362407f6f40e413d6dcb35888514dbaed6f8 (commit)
      from  bf4ceeded1497c79e72fba4f9ff15febae58108d (commit)


- Log -----------------------------------------------------------------
commit e3f0362407f6f40e413d6dcb35888514dbaed6f8
Author: Peiwei Hu <jlu.hpw at foxmail.com>
Date:   Mon Nov 15 00:41:21 2021 +0800

    BIO_read_filename: fix return check
    
    Reviewed-by: Matt Caswell <matt at openssl.org>
    Reviewed-by: Paul Dale <pauli at openssl.org>
    Reviewed-by: Tomas Mraz <tomas at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/17033)

-----------------------------------------------------------------------

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 a9e71046b3..e77b6ec097 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 b06d5d7a14..00f27cb78e 100644
--- a/test/sslapitest.c
+++ b/test/sslapitest.c
@@ -7994,7 +7994,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)))
@@ -8002,13 +8002,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)))


More information about the openssl-commits mailing list