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 <[email protected]>
  • Loading branch information
davidben authored and MylesBorins committed Sep 29, 2017
1 parent 8a13cdd commit 955348e
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 @@ -1477,12 +1477,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 955348e

Please sign in to comment.