Skip to content

Commit

Permalink
X509_NAME_cmp fix for empty name
Browse files Browse the repository at this point in the history
CLA: trivial

Fixes #21156

Reviewed-by: Todd Short <todd.short@me.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from #21155)

(cherry picked from commit ec59752)
  • Loading branch information
wimdec authored and t8m committed Jun 12, 2023
1 parent 8b52a23 commit ef2a438
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions crypto/x509/x509_cmp.c
Expand Up @@ -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;
}
Expand Down

0 comments on commit ef2a438

Please sign in to comment.