diff options
author | wtc%netscape.com <devnull@localhost> | 2003-05-29 14:59:59 +0000 |
---|---|---|
committer | wtc%netscape.com <devnull@localhost> | 2003-05-29 14:59:59 +0000 |
commit | fbb1f2b411e7856fc32764647620f753e1ae1d66 (patch) | |
tree | b07f3304a4d84c0e3f2713def5593887c290afc3 | |
parent | 757f88fd5efbe418589caf7566cc229d94806a9b (diff) | |
download | nss-hg-fbb1f2b411e7856fc32764647620f753e1ae1d66.tar.gz |
Partial fix for bug 204555, back ported from trunk for MOZILLA_1_4_BRANCH.
Correctly copy RDNs with empty AVA lists. r=wtc. a=asa.
-rw-r--r-- | security/nss/lib/certdb/secname.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/security/nss/lib/certdb/secname.c b/security/nss/lib/certdb/secname.c index 67e6bb8f5..63f279bce 100644 --- a/security/nss/lib/certdb/secname.c +++ b/security/nss/lib/certdb/secname.c @@ -329,17 +329,27 @@ SECStatus CERT_CopyRDN(PRArenaPool *arena, CERTRDN *to, CERTRDN *from) { CERTAVA **avas, *fava, *tava; - SECStatus rv; + SECStatus rv = SECSuccess; /* Copy each ava from from */ avas = from->avas; - while ((fava = *avas++) != 0) { - tava = CERT_CopyAVA(arena, fava); - if (!tava) return SECFailure; - rv = CERT_AddAVA(arena, to, tava); - if (rv) return rv; + if (avas) { + if (avas[0] == NULL) { + rv = CERT_AddAVA(arena, to, NULL); + return rv; + } + while ((fava = *avas++) != 0) { + tava = CERT_CopyAVA(arena, fava); + if (!tava) { + rv = SECFailure; + break; + } + rv = CERT_AddAVA(arena, to, tava); + if (rv != SECSuccess) + break; + } } - return SECSuccess; + return rv; } /************************************************************************/ |