[openssl] master update

dev at ddvo.net dev at ddvo.net
Tue May 4 16:26:37 UTC 2021


The branch master has been updated
       via  9520fe5f4987f3bd1a568ac4cf73e1a5401d5f6f (commit)
      from  8b25b0eb991bf70123bedc4c4c4e0215dd8bd926 (commit)


- Log -----------------------------------------------------------------
commit 9520fe5f4987f3bd1a568ac4cf73e1a5401d5f6f
Author: Dr. David von Oheimb <David.von.Oheimb at siemens.com>
Date:   Sat May 1 22:19:54 2021 +0200

    testutil/load.c: Add checks for file(name) == NULL
    
    Reviewed-by: Tomas Mraz <tomas at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/15120)

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

Summary of changes:
 test/testutil/load.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/test/testutil/load.c b/test/testutil/load.c
index 9b188eb8a6..444fb8a78d 100644
--- a/test/testutil/load.c
+++ b/test/testutil/load.c
@@ -20,7 +20,7 @@ X509 *load_cert_pem(const char *file, OSSL_LIB_CTX *libctx)
     X509 *cert = NULL;
     BIO *bio = NULL;
 
-    if (!TEST_ptr(bio = BIO_new(BIO_s_file())))
+    if (!TEST_ptr(file) || !TEST_ptr(bio = BIO_new(BIO_s_file())))
         return NULL;
     if (TEST_int_gt(BIO_read_filename(bio, file), 0)
             && TEST_ptr(cert = X509_new_ex(libctx, NULL)))
@@ -30,17 +30,14 @@ X509 *load_cert_pem(const char *file, OSSL_LIB_CTX *libctx)
     return cert;
 }
 
-STACK_OF(X509) *load_certs_pem(const char *filename)
+STACK_OF(X509) *load_certs_pem(const char *file)
 {
     STACK_OF(X509) *certs;
     BIO *bio;
     X509 *x;
 
-    bio = BIO_new_file(filename, "r");
-
-    if (bio == NULL) {
+    if (!TEST_ptr(file) || (bio = BIO_new_file(file, "r")) == NULL)
         return NULL;
-    }
 
     certs = sk_X509_new_null();
     if (certs == NULL) {
@@ -74,7 +71,7 @@ EVP_PKEY *load_pkey_pem(const char *file, OSSL_LIB_CTX *libctx)
     EVP_PKEY *key = NULL;
     BIO *bio = NULL;
 
-    if (!TEST_ptr(bio = BIO_new(BIO_s_file())))
+    if (!TEST_ptr(file) || !TEST_ptr(bio = BIO_new(BIO_s_file())))
         return NULL;
     if (TEST_int_gt(BIO_read_filename(bio, file), 0))
         (void)TEST_ptr(key = PEM_read_bio_PrivateKey_ex(bio, NULL, NULL, NULL,


More information about the openssl-commits mailing list