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
  • Loading branch information
wimdec committed Jun 8, 2023
1 parent 247f307 commit 201c8be
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions crypto/x509/x509_cmp.c
Original file line number Diff line number Diff line change
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 201c8be

Please sign in to comment.