From b08d2e7aa03425ce1ceba96b2b236f3722d3cc77 Mon Sep 17 00:00:00 2001 From: JiashengJiang Date: Wed, 26 Mar 2025 17:40:16 -0400 Subject: [PATCH] apps/lib/apps.c: Add a check for OPENSSL_strdup() 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 Reviewed-by: Paul Dale Reviewed-by: Tim Hudson Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/27172) (cherry picked from commit 930c645e6b74a09398f6345b2d265c38ff035afe) --- apps/lib/apps.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/lib/apps.c b/apps/lib/apps.c index 06c1947449a..1b81f3859e0 100644 --- a/apps/lib/apps.c +++ b/apps/lib/apps.c @@ -1722,6 +1722,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 -- 2.47.2