Fix bugs in X509_NAME_ENTRY_set
authorRich Salz <rsalz@openssl.org>
Fri, 6 Apr 2018 02:55:28 +0000 (22:55 -0400)
committerRich Salz <rsalz@openssl.org>
Fri, 6 Apr 2018 02:55:28 +0000 (22:55 -0400)
commitbbf27cd58337116c57a1c942153330ff83d5540a
tree6b691accae1da2df7b431809fdf5ec2d3ed06f1a
parent7de2b9c4afd90359e47d81a5fa70bcb8506fbf91
Fix bugs in X509_NAME_ENTRY_set

The wrong "set" field was incremented in the wrong place and would
create a new RDN, not a multi-valued RDN.
RDN inserts would happen after not before.
Prepending an entry to an RDN incorrectly created a new RDN

Anything which built up an X509_NAME could get a messed-up structure,
which would then be "wrong" for anyone using that name.

Thanks to Ingo Schwarze for extensive debugging and the initial
fix (documented in GitHub issue #5870).

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/5882)
crypto/x509/x509name.c