Skip to content

Commit af63b38

Browse files
davidbenMylesBorins
authored andcommitted
crypto: use X509V3_EXT_d2i
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>
1 parent 6b08128 commit af63b38

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

src/node_crypto.cc

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1463,12 +1463,7 @@ static bool SafeX509ExtPrint(BIO* out, X509_EXTENSION* ext) {
14631463
if (method != X509V3_EXT_get_nid(NID_subject_alt_name))
14641464
return false;
14651465

1466-
const unsigned char* p = ext->value->data;
1467-
GENERAL_NAMES* names = reinterpret_cast<GENERAL_NAMES*>(ASN1_item_d2i(
1468-
NULL,
1469-
&p,
1470-
ext->value->length,
1471-
ASN1_ITEM_ptr(method->it)));
1466+
GENERAL_NAMES* names = static_cast<GENERAL_NAMES*>(X509V3_EXT_d2i(ext));
14721467
if (names == NULL)
14731468
return false;
14741469

0 commit comments

Comments
 (0)