Skip to content

Commit 00b4cf8

Browse files
committed
crypto: fix missing nullptr check on RSA_new()
Not checking this can cause a null deref. Since there is already a null check at the bottom of the function with `NewRSA()`.
1 parent 4a13a62 commit 00b4cf8

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/crypto/crypto_rsa.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,8 @@ KeyObjectData ImportJWKRsaKey(Environment* env,
385385
KeyType type = d_value->IsString() ? kKeyTypePrivate : kKeyTypePublic;
386386

387387
RSAPointer rsa(RSA_new());
388+
if (!rsa) return {};
389+
388390
ncrypto::Rsa rsa_view(rsa.get());
389391

390392
ByteSource n = ByteSource::FromEncodedString(env, n_value.As<String>());

0 commit comments

Comments
 (0)