mirror of
https://github.com/openssl/openssl.git
synced 2025-01-30 14:01:55 +08:00
X509_NAME_cmp: if canon_enclen is 0 for both names return 0
We do not care whether canon_enc is NULL in this case. Fixes #14813 Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com> (Merged from https://github.com/openssl/openssl/pull/14832)
This commit is contained in:
parent
d32fc2c51b
commit
74bcbea76f
@ -269,11 +269,14 @@ int X509_NAME_cmp(const X509_NAME *a, const X509_NAME *b)
|
||||
return -2;
|
||||
}
|
||||
|
||||
ret = a->canon_enclen - b->canon_enclen;
|
||||
if (ret == 0 && a->canon_enclen == 0)
|
||||
return 0;
|
||||
|
||||
if (a->canon_enc == NULL || b->canon_enc == NULL)
|
||||
return -2;
|
||||
|
||||
ret = a->canon_enclen - b->canon_enclen;
|
||||
if (ret == 0 && a->canon_enclen != 0)
|
||||
if (ret == 0)
|
||||
ret = memcmp(a->canon_enc, b->canon_enc, a->canon_enclen);
|
||||
|
||||
return ret < 0 ? -1 : ret > 0;
|
||||
|
Loading…
Reference in New Issue
Block a user