From ff42e217a1b668a8c5b158e634d2aaab9bfcd601 Mon Sep 17 00:00:00 2001 From: "jpierre%netscape.com" Date: Tue, 2 Dec 2003 05:05:30 +0000 Subject: [PATCH] Fix for 54088 . Don't try to encode attributes with no value. r=wtc git-svn-id: svn://10.0.0.236/trunk@149908 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/security/nss/lib/smime/cmsattr.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/mozilla/security/nss/lib/smime/cmsattr.c b/mozilla/security/nss/lib/smime/cmsattr.c index b9f5709b8c5..4c8e9edc179 100644 --- a/mozilla/security/nss/lib/smime/cmsattr.c +++ b/mozilla/security/nss/lib/smime/cmsattr.c @@ -34,7 +34,7 @@ /* * CMS attributes. * - * $Id: cmsattr.c,v 1.6 2003-09-19 04:14:50 jpierre%netscape.com Exp $ + * $Id: cmsattr.c,v 1.7 2003-12-02 05:05:30 jpierre%netscape.com Exp $ */ #include "cmslocal.h" @@ -217,9 +217,12 @@ cms_attr_choose_attr_value_template(void *src_or_dest, PRBool encoding) attribute = (NSSCMSAttribute *)src_or_dest; - if (encoding && attribute->encoded) - /* we're encoding, and the attribute value is already encoded. */ - return SEC_ASN1_GET(SEC_AnyTemplate); + if (encoding && (!attribute->values || !attribute->values[0] || + attribute->encoded)) { + /* we're encoding, and the attribute has no value or the attribute + * value is already encoded. */ + return SEC_ASN1_GET(SEC_AnyTemplate); + } /* get attribute's typeTag */ oiddata = attribute->typeTag;