[openssl] openssl-3.0 update

tomas at openssl.org tomas at openssl.org
Mon Feb 14 09:04:16 UTC 2022


The branch openssl-3.0 has been updated
       via  e2387e6bd4ee69e0702d1a489045b72632b91e48 (commit)
      from  cfbcfe86c2ccdd308fc6fa3d3245dd6eb5774b0e (commit)


- Log -----------------------------------------------------------------
commit e2387e6bd4ee69e0702d1a489045b72632b91e48
Author: Jiasheng Jiang <jiasheng at iscas.ac.cn>
Date:   Thu Feb 10 11:21:47 2022 +0800

    openssl rehash: add check for OPENSSL_strdup
    
    As the potential failure of the memory allocation,
    it should be better to check the return value of
    OPENSSL_strdup() and return error if fails.
    Also, we need to restore the 'ep' to be NULL if fails.
    
    Signed-off-by: Jiasheng Jiang <jiasheng at iscas.ac.cn>
    
    Reviewed-by: Paul Dale <pauli at openssl.org>
    Reviewed-by: Tomas Mraz <tomas at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/17676)
    
    (cherry picked from commit 79cda38cff834224fb9d86dc7433b4f60688ce49)

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

Summary of changes:
 apps/rehash.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/apps/rehash.c b/apps/rehash.c
index 7fe01de11c..ae91654fe9 100644
--- a/apps/rehash.c
+++ b/apps/rehash.c
@@ -168,6 +168,12 @@ static int add_entry(enum Type type, unsigned int hash, const char *filename,
         *ep = nilhentry;
         ep->old_id = ~0;
         ep->filename = OPENSSL_strdup(filename);
+        if (ep->filename == NULL) {
+            OPENSSL_free(ep);
+            ep = NULL;
+            BIO_printf(bio_err, "out of memory\n");
+            return 1;
+        }
         if (bp->last_entry)
             bp->last_entry->next = ep;
         if (bp->first_entry == NULL)


More information about the openssl-commits mailing list