From a099a580620e7a276f2a7d80364ecb38202e2b84 Mon Sep 17 00:00:00 2001 From: "nelsonb%netscape.com" Date: Mon, 27 Sep 2004 22:41:41 +0000 Subject: [PATCH] Fix bugzilla bug 261496. Absent OPTIONAL CHOICEs should not cause fatal errors. Fix printing code to not crash on missing optional nextUpdate. r=julien.pierre --- security/nss/cmd/lib/secutil.c | 3 ++- security/nss/lib/util/quickder.c | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/security/nss/cmd/lib/secutil.c b/security/nss/cmd/lib/secutil.c index 95aaefed6a1..4287747d68c 100644 --- a/security/nss/cmd/lib/secutil.c +++ b/security/nss/cmd/lib/secutil.c @@ -2486,7 +2486,8 @@ SECU_PrintCRLInfo(FILE *out, CERTCrl *crl, char *m, int level) level + 1); SECU_PrintName(out, &(crl->name), "Issuer", level + 1); SECU_PrintTimeChoice(out, &(crl->lastUpdate), "This Update", level + 1); - SECU_PrintTimeChoice(out, &(crl->nextUpdate), "Next Update", level + 1); + if (crl->nextUpdate.data && crl->nextUpdate.len) /* is optional */ + SECU_PrintTimeChoice(out, &(crl->nextUpdate), "Next Update", level + 1); if (crl->entries != NULL) { iv = 0; diff --git a/security/nss/lib/util/quickder.c b/security/nss/lib/util/quickder.c index 72f9c7c48a3..340aff7f1f1 100644 --- a/security/nss/lib/util/quickder.c +++ b/security/nss/lib/util/quickder.c @@ -216,8 +216,9 @@ static SECStatus MatchComponentType(const SEC_ASN1Template* templateEntry, return SECSuccess; } } - PORT_SetError(SEC_ERROR_BAD_DER); - return SECFailure; + /* no match, caller must decide if this is BAD DER, or not. */ + *match = PR_FALSE; + return SECSuccess; } if (kind & SEC_ASN1_ANY)