diff options
author | Hugo Landau <hlandau@openssl.org> | 2023-01-17 17:45:42 +0000 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2023-02-07 17:05:10 +0100 |
commit | 7880536fe17c2b5450e279155bedd51771d28c9f (patch) | |
tree | 870d0214cc69256c19486ae6a66105cec22a0ee5 | |
parent | adf77d6657e836fc87391fad53d857927a764297 (diff) |
Fix GENERAL_NAME_cmp for x400Address (master)
CVE-2023-0286
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
-rw-r--r-- | crypto/x509/v3_genn.c | 2 | ||||
-rw-r--r-- | include/openssl/x509v3.h.in | 2 | ||||
-rw-r--r-- | test/v3nametest.c | 8 |
3 files changed, 10 insertions, 2 deletions
diff --git a/crypto/x509/v3_genn.c b/crypto/x509/v3_genn.c index c0a7166cd0..1741c2d2f6 100644 --- a/crypto/x509/v3_genn.c +++ b/crypto/x509/v3_genn.c @@ -98,7 +98,7 @@ int GENERAL_NAME_cmp(GENERAL_NAME *a, GENERAL_NAME *b) return -1; switch (a->type) { case GEN_X400: - result = ASN1_TYPE_cmp(a->d.x400Address, b->d.x400Address); + result = ASN1_STRING_cmp(a->d.x400Address, b->d.x400Address); break; case GEN_EDIPARTY: diff --git a/include/openssl/x509v3.h.in b/include/openssl/x509v3.h.in index 80c69960b0..2d7164e3a2 100644 --- a/include/openssl/x509v3.h.in +++ b/include/openssl/x509v3.h.in @@ -157,7 +157,7 @@ typedef struct GENERAL_NAME_st { OTHERNAME *otherName; /* otherName */ ASN1_IA5STRING *rfc822Name; ASN1_IA5STRING *dNSName; - ASN1_TYPE *x400Address; + ASN1_STRING *x400Address; X509_NAME *directoryName; EDIPARTYNAME *ediPartyName; ASN1_IA5STRING *uniformResourceIdentifier; diff --git a/test/v3nametest.c b/test/v3nametest.c index 6d2e2f8e27..0341995dde 100644 --- a/test/v3nametest.c +++ b/test/v3nametest.c @@ -644,6 +644,14 @@ static struct gennamedata { 0xb7, 0x09, 0x02, 0x02 }, 15 + }, { + /* + * Regression test for CVE-2023-0286. + */ + { + 0xa3, 0x00 + }, + 2 } }; |