From f8922ea94286a9029ffd3a68b9247dc8f38206b6 Mon Sep 17 00:00:00 2001 From: Kevin Jones Date: Mon, 8 Apr 2024 13:26:18 -0400 Subject: [PATCH] The implementation was previously only freeing the STACK_OF, but not the contents of the stack. This change fixes not freeing the individual GENERAL_NAME items. --- .../libs/System.Security.Cryptography.Native/openssl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/native/libs/System.Security.Cryptography.Native/openssl.c b/src/native/libs/System.Security.Cryptography.Native/openssl.c index 7382204589542..fa2302b780e3e 100644 --- a/src/native/libs/System.Security.Cryptography.Native/openssl.c +++ b/src/native/libs/System.Security.Cryptography.Native/openssl.c @@ -627,8 +627,8 @@ BIO* CryptoNative_GetX509NameInfo(X509* x509, int32_t nameType, int32_t forIssue break; } - STACK_OF(GENERAL_NAME)* altNames = (STACK_OF(GENERAL_NAME)*)( - X509_get_ext_d2i(x509, forIssuer ? NID_issuer_alt_name : NID_subject_alt_name, NULL, NULL)); + GENERAL_NAMES* altNames = (GENERAL_NAMES*) + X509_get_ext_d2i(x509, forIssuer ? NID_issuer_alt_name : NID_subject_alt_name, NULL, NULL); if (altNames) { @@ -686,13 +686,13 @@ BIO* CryptoNative_GetX509NameInfo(X509* x509, int32_t nameType, int32_t forIssue { BIO* b = BIO_new(BIO_s_mem()); ASN1_STRING_print_ex(b, str, ASN1_STRFLGS_UTF8_CONVERT); - sk_GENERAL_NAME_free(altNames); + GENERAL_NAMES_free(altNames); return b; } } } - sk_GENERAL_NAME_free(altNames); + GENERAL_NAMES_free(altNames); } }