Skip to content

Commit 8106d02

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 d52e9bc commit 8106d02

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
@@ -263,6 +263,7 @@ void InitCryptoOnce() {
263263
Mutex::ScopedLock fips_lock(fips_mutex);
264264
#ifndef OPENSSL_IS_BORINGSSL
265265
OPENSSL_INIT_SETTINGS* settings = OPENSSL_INIT_new();
266+
CHECK_NOT_NULL(settings);
266267

267268
#if OPENSSL_VERSION_MAJOR < 3
268269
// --openssl-config=...

src/node.cc

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

12181218
OPENSSL_INIT_SETTINGS* settings = OPENSSL_INIT_new();
1219+
CHECK_NOT_NULL(settings);
12191220
OPENSSL_INIT_set_config_filename(settings, conf_file);
12201221
OPENSSL_INIT_set_config_appname(settings, conf_section_name);
12211222
OPENSSL_INIT_set_config_file_flags(settings,

0 commit comments

Comments
 (0)