Fix bugs in X509_NAME_ENTRY_set
authorRich Salz <rsalz@openssl.org>
Fri, 6 Apr 2018 02:55:28 +0000 (22:55 -0400)
committerRichard Levitte <levitte@openssl.org>
Thu, 12 Apr 2018 09:18:54 +0000 (11:18 +0200)
commit7faab6869b09c7b66b52dd7b71469fe862157e32
tree584f0689e2c00436bbf6df4eead1ae99bba6d9a9
parentca1beab7c11f0fe5e2717adc85fcf4ee8a9b4ae1
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)

(cherry picked from commit bbf27cd58337116c57a1c942153330ff83d5540a)
crypto/x509/x509name.c