diff options
author | nelson%bolyard.com <devnull@localhost> | 2007-05-07 22:46:06 +0000 |
---|---|---|
committer | nelson%bolyard.com <devnull@localhost> | 2007-05-07 22:46:06 +0000 |
commit | dbb4678691f859b39011636877cfec62494913d2 (patch) | |
tree | 30287e7cbe3aa8d79f1758635d7464316c0a4214 | |
parent | 52d77059005ff81b8fdd2f8e4a5b5741515d34f8 (diff) | |
download | nss-hg-dbb4678691f859b39011636877cfec62494913d2.tar.gz |
Bug 379625 ? Accept SMIME preferences even when they contain NULL parameters.
r=rrelyea,wtc
-rw-r--r-- | security/nss/lib/smime/smimeutil.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/security/nss/lib/smime/smimeutil.c b/security/nss/lib/smime/smimeutil.c index c26330ba5..e7211280b 100644 --- a/security/nss/lib/smime/smimeutil.c +++ b/security/nss/lib/smime/smimeutil.c @@ -351,10 +351,14 @@ nss_SMIME_FindCipherForSMIMECap(NSSSMIMECapability *cap) * 2 NULLs as equal and NULL and non-NULL as not equal), we could * use that here instead of all of the following comparison code. */ - if (cap->parameters.data == NULL && smime_cipher_map[i].parms == NULL) - break; /* both empty: bingo */ - - if (cap->parameters.data != NULL && smime_cipher_map[i].parms != NULL && + if (!smime_cipher_map[i].parms) { + if (!cap->parameters.data || !cap->parameters.len) + break; /* both empty: bingo */ + if (cap->parameters.len == 2 && + cap->parameters.data[0] == SEC_ASN1_NULL && + cap->parameters.data[1] == 0) + break; /* DER NULL == NULL, bingo */ + } else if (cap->parameters.data != NULL && cap->parameters.len == smime_cipher_map[i].parms->len && PORT_Memcmp (cap->parameters.data, smime_cipher_map[i].parms->data, cap->parameters.len) == 0) @@ -365,8 +369,7 @@ nss_SMIME_FindCipherForSMIMECap(NSSSMIMECapability *cap) if (i == smime_cipher_map_count) return 0; /* no match found */ - else - return smime_cipher_map[i].cipher; /* match found, point to cipher */ + return smime_cipher_map[i].cipher; /* match found, point to cipher */ } /* |