[openssl] master update

Dr. Paul Dale pauli at openssl.org
Wed Apr 7 13:31:13 UTC 2021


The branch master has been updated
       via  014498fff9ee2e71dfdd82978b8896b05c9c8cb0 (commit)
       via  97ef45ea135a7c88bf986a7fad5f2a9d6347f2e6 (commit)
      from  ccf19c23c03ff0355d5008f73b77a0e22ee8ca8c (commit)


- Log -----------------------------------------------------------------
commit 014498fff9ee2e71dfdd82978b8896b05c9c8cb0
Author: Pauli <ppzgs1 at gmail.com>
Date:   Sun Apr 4 18:00:26 2021 +1000

    test: fix coverity 1475940: negative return
    
    Reviewed-by: Tomas Mraz <tomas at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/14769)

commit 97ef45ea135a7c88bf986a7fad5f2a9d6347f2e6
Author: Pauli <ppzgs1 at gmail.com>
Date:   Sun Apr 4 17:58:32 2021 +1000

    test: fix coverity 1475941: resource leak
    
    Reviewed-by: Tomas Mraz <tomas at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/14769)

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

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

diff --git a/test/dhtest.c b/test/dhtest.c
index 836d800c29..189b5ae13f 100644
--- a/test/dhtest.c
+++ b/test/dhtest.c
@@ -249,16 +249,18 @@ static int dh_computekey_range_test(void)
         || !TEST_true(DH_set0_pqg(dh, p, q, g)))
         goto err;
     p = q = g = NULL;
-    sz = DH_size(dh);
 
-    if (!TEST_ptr(buf = OPENSSL_malloc(sz))
+    if (!TEST_int_gt(sz = DH_size(dh), 0)
+        || !TEST_ptr(buf = OPENSSL_malloc(sz))
         || !TEST_ptr(pub = BN_new())
         || !TEST_ptr(priv = BN_new()))
         goto err;
 
     if (!TEST_true(BN_set_word(priv, 1))
-        || !TEST_true(DH_set0_key(dh, NULL, priv))
-        || !TEST_true(BN_set_word(pub, 1)))
+        || !TEST_true(DH_set0_key(dh, NULL, priv)))
+        goto err;
+    priv = NULL;
+    if (!TEST_true(BN_set_word(pub, 1)))
         goto err;
 
     /* Given z = pub ^ priv mod p */
@@ -282,6 +284,7 @@ static int dh_computekey_range_test(void)
     ret = 1;
 err:
     OPENSSL_free(buf);
+    BN_free(priv);
     BN_free(pub);
     BN_free(g);
     BN_free(q);


More information about the openssl-commits mailing list