Skip to content

Commit be4e809

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 <[email protected]>
1 parent 93d5ead commit be4e809

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
@@ -1477,12 +1477,7 @@ static bool SafeX509ExtPrint(BIO* out, X509_EXTENSION* ext) {
14771477
if (method != X509V3_EXT_get_nid(NID_subject_alt_name))
14781478
return false;
14791479

1480-
const unsigned char* p = ext->value->data;
1481-
GENERAL_NAMES* names = reinterpret_cast<GENERAL_NAMES*>(ASN1_item_d2i(
1482-
NULL,
1483-
&p,
1484-
ext->value->length,
1485-
ASN1_ITEM_ptr(method->it)));
1480+
GENERAL_NAMES* names = static_cast<GENERAL_NAMES*>(X509V3_EXT_d2i(ext));
14861481
if (names == NULL)
14871482
return false;
14881483

0 commit comments

Comments
 (0)