Skip to content

crypto: Fix malloc mixing in X509ToObject

Rodrigo Muino Tomonari requested to merge github/fork/davidben/ec-malloc into master

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, mirror the ECDH::GetPublicKey code and use EC_POINT_point2oct.

This preserves the existing behavior where encoding failures are silently ignored, but it is probably safe to CHECK fail them instead (whichever you all prefer).

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

Merge request reports

Loading