diff options
author | Wim Decroix <wim.decroix@auth0.com> | 2023-06-08 12:40:36 +0200 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2023-06-12 15:25:43 +0200 |
commit | ec59752835f616860cd9451d6cfcea16bfc3ad05 (patch) | |
tree | 462e87790c48f266a47039bc6123c8efa5740b4a | |
parent | e8dc77f85f251752258203cf9cbfa077fd8b3173 (diff) |
X509_NAME_cmp fix for empty name
CLA: trivial
Fixes #21156
Reviewed-by: Todd Short <todd.short@me.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21155)
-rw-r--r-- | crypto/x509/x509_cmp.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/crypto/x509/x509_cmp.c b/crypto/x509/x509_cmp.c index 6fc2fd719e..9c5847b450 100644 --- a/crypto/x509/x509_cmp.c +++ b/crypto/x509/x509_cmp.c @@ -277,11 +277,11 @@ int X509_NAME_cmp(const X509_NAME *a, const X509_NAME *b) if (ret == 0 && a->canon_enclen == 0) return 0; - if (a->canon_enc == NULL || b->canon_enc == NULL) - return -2; - - if (ret == 0) + if (ret == 0) { + if (a->canon_enc == NULL || b->canon_enc == NULL) + return -2; ret = memcmp(a->canon_enc, b->canon_enc, a->canon_enclen); + } return ret < 0 ? -1 : ret > 0; } |