]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
apps/lib/apps.c: Add a check for OPENSSL_strdup()
authorJiashengJiang <jiasheng@purdue.edu>
Wed, 26 Mar 2025 21:40:16 +0000 (17:40 -0400)
committerTomas Mraz <tomas@openssl.org>
Fri, 28 Mar 2025 10:40:02 +0000 (11:40 +0100)
Add a check for the return value of OPENSSL_strdup() to guarantee the success of allocation, similar to the other call sites.

Fixes: c7d5ea2670 ("Prepare to detect index changes in OCSP responder.")
Signed-off-by: JiashengJiang <jiasheng@purdue.edu>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27172)

apps/lib/apps.c

index 9b2986c78b80ee019a229f15393151b71ecc4661..d4e72307de586adaf554ef72c8f39464f5cf1dae 100644 (file)
@@ -1758,6 +1758,9 @@ CA_DB *load_index(const char *dbfile, DB_ATTR *db_attr)
     }
 
     retdb->dbfname = OPENSSL_strdup(dbfile);
+    if (retdb->dbfname == NULL)
+        goto err;
+
 #ifndef OPENSSL_NO_POSIX_IO
     retdb->dbst = dbst;
 #endif