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 <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)
This commit is contained in:
JiashengJiang 2025-03-26 17:40:16 -04:00 committed by Tomas Mraz
parent 60f2a71400
commit 930c645e6b

View 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