GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — crypto: fix missing nullptr check on RSA_new() · nodejs/node@a32a598

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src/crypto
    • crypto_rsa.cc
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/crypto/crypto_rsa.cc‎

Copy file name to clipboardExpand all lines: src/crypto/crypto_rsa.cc
+9-1Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,11 @@ KeyObjectData ImportJWKRsaKey(Environment* env,
385385
KeyType type = d_value->IsString() ? kKeyTypePrivate : kKeyTypePublic;
386386

387387
RSAPointer rsa(RSA_new());
388+
if (!rsa) {
389+
THROW_ERR_CRYPTO_OPERATION_FAILED(env, "Unable to create RSA pointer");
390+
return {};
391+
}
392+
388393
ncrypto::Rsa rsa_view(rsa.get());
389394

390395
ByteSource n = ByteSource::FromEncodedString(env, n_value.As<String>());
@@ -435,7 +440,10 @@ KeyObjectData ImportJWKRsaKey(Environment* env,
435440
}
436441

437442
auto pkey = EVPKeyPointer::NewRSA(std::move(rsa));
438-
if (!pkey) return {};
443+
if (!pkey) {
444+
THROW_ERR_CRYPTO_OPERATION_FAILED(env, "Unable to create key pointer");
445+
return {};
446+
}
439447

440448
return KeyObjectData::CreateAsymmetric(type, std::move(pkey));
441449
}

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.