1diff --git a/crypto/x509v3/v3_genn.c b/crypto/x509v3/v3_genn.c 2index 87a5eff47c..e54ddc55c9 100644 3--- a/crypto/x509v3/v3_genn.c 4+++ b/crypto/x509v3/v3_genn.c 5@@ -98,7 +98,7 @@ int GENERAL_NAME_cmp(GENERAL_NAME *a, GENERAL_NAME *b) 6 return -1; 7 switch (a->type) { 8 case GEN_X400: 9- result = ASN1_TYPE_cmp(a->d.x400Address, b->d.x400Address); 10+ result = ASN1_STRING_cmp(a->d.x400Address, b->d.x400Address); 11 break; 12 13 case GEN_EDIPARTY: 14diff --git a/include/openssl/x509v3.h b/include/openssl/x509v3.h 15index 90fa3592ce..e61c0f29d4 100644 16--- a/include/openssl/x509v3.h 17+++ b/include/openssl/x509v3.h 18@@ -136,7 +136,7 @@ typedef struct GENERAL_NAME_st { 19 OTHERNAME *otherName; /* otherName */ 20 ASN1_IA5STRING *rfc822Name; 21 ASN1_IA5STRING *dNSName; 22- ASN1_TYPE *x400Address; 23+ ASN1_STRING *x400Address; 24 X509_NAME *directoryName; 25 EDIPARTYNAME *ediPartyName; 26 ASN1_IA5STRING *uniformResourceIdentifier; 27diff --git a/test/v3nametest.c b/test/v3nametest.c 28index d1852190b8..37819da8fd 100644 29--- a/test/v3nametest.c 30+++ b/test/v3nametest.c 31@@ -646,6 +646,14 @@ static struct gennamedata { 32 0xb7, 0x09, 0x02, 0x02 33 }, 34 15 35+ }, { 36+ /* 37+ * Regression test for CVE-2023-0286. 38+ */ 39+ { 40+ 0xa3, 0x00 41+ }, 42+ 2 43 } 44 }; 45