[openssl] master update

tomas at openssl.org tomas at openssl.org
Tue Jun 29 16:42:09 UTC 2021


The branch master has been updated
       via  452580e5b0f85201006bacb1a697e0c5b7154b76 (commit)
       via  475c5bbd1091717411d67b8662320a1b0a8c9e42 (commit)
      from  69e14a546d5455de39222d1553ad18a1631e5fe9 (commit)


- Log -----------------------------------------------------------------
commit 452580e5b0f85201006bacb1a697e0c5b7154b76
Author: Tomas Mraz <tomas at openssl.org>
Date:   Mon Jun 28 17:13:31 2021 +0200

    coverity #1486532: fix potential NULL dereference in test_mk_file_path()
    
    Reviewed-by: Ben Kaduk <kaduk at mit.edu>
    Reviewed-by: Paul Dale <pauli at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/15942)

commit 475c5bbd1091717411d67b8662320a1b0a8c9e42
Author: Tomas Mraz <tomas at openssl.org>
Date:   Mon Jun 28 17:09:08 2021 +0200

    coverity #1486531: return error properly from x509_pubkey_ex_new_ex()
    
    Reviewed-by: Ben Kaduk <kaduk at mit.edu>
    Reviewed-by: Paul Dale <pauli at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/15942)

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

Summary of changes:
 crypto/x509/x_pubkey.c | 1 +
 test/testutil/driver.c | 5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/crypto/x509/x_pubkey.c b/crypto/x509/x_pubkey.c
index b20b756e9a..0c07c39a1f 100644
--- a/crypto/x509/x_pubkey.c
+++ b/crypto/x509/x_pubkey.c
@@ -116,6 +116,7 @@ static int x509_pubkey_ex_new_ex(ASN1_VALUE **pval, const ASN1_ITEM *it,
         || !x509_pubkey_ex_populate((ASN1_VALUE **)&ret, NULL)
         || !x509_pubkey_set0_libctx(ret, libctx, propq)) {
         x509_pubkey_ex_free((ASN1_VALUE **)&ret, NULL);
+        ret = NULL;
         ERR_raise(ERR_LIB_ASN1, ERR_R_MALLOC_FAILURE);
     } else {
         *pval = (ASN1_VALUE *)ret;
diff --git a/test/testutil/driver.c b/test/testutil/driver.c
index f91d1ab932..8568a51fd7 100644
--- a/test/testutil/driver.c
+++ b/test/testutil/driver.c
@@ -439,11 +439,12 @@ char *test_mk_file_path(const char *dir, const char *file)
     char *dir_end;
     char dir_end_sep;
 # endif
-    size_t len = strlen(dir) + strlen(sep) + strlen(file) + 1;
+    size_t dirlen = dir != NULL ? strlen(dir) : 0;
+    size_t len = dirlen + strlen(sep) + strlen(file) + 1;
     char *full_file = OPENSSL_zalloc(len);
 
     if (full_file != NULL) {
-        if (dir != NULL && dir[0] != '\0') {
+        if (dir != NULL && dirlen > 0) {
             OPENSSL_strlcpy(full_file, dir, len);
 # ifdef OPENSSL_SYS_VMS
             /*


More information about the openssl-commits mailing list