crypto: fix malloc mixing in X509ToObject · nodejs/node@3e010af · GitHub
Skip to content

Commit 3e010af

Browse files
davidbenaddaleax
authored andcommitted
crypto: fix malloc mixing in X509ToObject
EC_KEY_key2buf returns an OPENSSL_malloc'd pointer so it shouldn't be passed into Buffer::New, which expect a libc malloc'd pointer. Instead, factor out the ECDH::GetPublicKey code which uses EC_POINT_point2oct. This preserves the existing behavior where encoding failures are silently ignored, but it is probably safe to CHECK fail them instead. PR-URL: #25717 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
1 parent ee3165d commit 3e010af

1 file changed

Lines changed: 30 additions & 42 deletions

File tree

src/node_crypto.cc

Lines changed: 30 additions & 42 deletions

0 commit comments

Comments
 (0)