From af63b3814295ce1b8d66bfa18fe1a542d59e18bf Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Mon, 11 Sep 2017 17:24:35 -0400 Subject: [PATCH] crypto: use X509V3_EXT_d2i There is no need to reach into quite so many internals to decode an extension. PR-URL: https://github.com/nodejs/node/pull/15348 Reviewed-By: Ben Noordhuis --- src/node_crypto.cc | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/node_crypto.cc b/src/node_crypto.cc index f33b885ff47507..99ed0ddf0808bb 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -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(ASN1_item_d2i( - NULL, - &p, - ext->value->length, - ASN1_ITEM_ptr(method->it))); + GENERAL_NAMES* names = static_cast(X509V3_EXT_d2i(ext)); if (names == NULL) return false;