Skip to content

Commit 87daea4

Browse files
ndosscheaduh95
authored andcommitted
crypto: add null checks for OPENSSL_INIT_new()
Other calls in initialization code often already check for null pointers via CHECK_NOT_NULL(). Do the same here. Signed-off-by: ndossche <7771979+ndossche@users.noreply.github.com> PR-URL: #63457 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Aviv Keller <me@aviv.sh>
1 parent 86b2497 commit 87daea4

2 files changed

Lines changed: 2 additions & 0 deletions

File tree

‎src/crypto/crypto_util.cc‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ void InitCryptoOnce() {
151151
Mutex::ScopedLock fips_lock(fips_mutex);
152152
#ifndef OPENSSL_IS_BORINGSSL
153153
OPENSSL_INIT_SETTINGS* settings = OPENSSL_INIT_new();
154+
CHECK_NOT_NULL(settings);
154155

155156
#if OPENSSL_VERSION_MAJOR < 3
156157
// --openssl-config=...

‎src/node.cc‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1232,6 +1232,7 @@ InitializeOncePerProcessInternal(const std::vector<std::string>& args,
12321232
}
12331233

12341234
OPENSSL_INIT_SETTINGS* settings = OPENSSL_INIT_new();
1235+
CHECK_NOT_NULL(settings);
12351236
OPENSSL_INIT_set_config_filename(settings, conf_file);
12361237
OPENSSL_INIT_set_config_appname(settings, conf_section_name);
12371238
OPENSSL_INIT_set_config_file_flags(settings,

0 commit comments

Comments
 (0)