Skip to content

Commit

Permalink
crypto: use X509V3_EXT_d2i
Browse files Browse the repository at this point in the history
There is no need to reach into quite so many internals to decode an
extension.

PR-URL: #15348
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
  • Loading branch information
davidben authored and MylesBorins committed Oct 17, 2017
1 parent 612f207 commit 55a0b11
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/node_crypto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1463,12 +1463,7 @@ static bool SafeX509ExtPrint(BIO* out, X509_EXTENSION* ext) {
if (method != X509V3_EXT_get_nid(NID_subject_alt_name))
return false;

const unsigned char* p = ext->value->data;
GENERAL_NAMES* names = reinterpret_cast<GENERAL_NAMES*>(ASN1_item_d2i(
NULL,
&p,
ext->value->length,
ASN1_ITEM_ptr(method->it)));
GENERAL_NAMES* names = static_cast<GENERAL_NAMES*>(X509V3_EXT_d2i(ext));
if (names == NULL)
return false;

Expand Down

0 comments on commit 55a0b11

Please sign in to comment.