summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrelyea%netscape.com <devnull@localhost>2002-08-01 18:42:23 +0000
committerrelyea%netscape.com <devnull@localhost>2002-08-01 18:42:23 +0000
commitde54fecd1822dc0ac0c357621cb979395f1c08b8 (patch)
tree8b3eb513082fd49c563f0a684be50be1ffe0d21b
parentd3e9f5642c96336d4178027296d5b90b6d358b56 (diff)
downloadnss-hg-de54fecd1822dc0ac0c357621cb979395f1c08b8.tar.gz
Handle the case where we can't decode the certificate.
review=wtc & ian.mcgreer
-rw-r--r--security/nss/lib/pki/pkibase.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/security/nss/lib/pki/pkibase.c b/security/nss/lib/pki/pkibase.c
index 626dc6c90..a06668cf6 100644
--- a/security/nss/lib/pki/pkibase.c
+++ b/security/nss/lib/pki/pkibase.c
@@ -842,6 +842,17 @@ loser:
return PR_FAILURE;
}
+static void
+nssPKIObjectCollection_RemoveNode
+(
+ nssPKIObjectCollection *collection,
+ pkiObjectCollectionNode *node
+)
+{
+ PR_REMOVE_LINK(&node->link);
+ collection->size--;
+}
+
static PRStatus
nssPKIObjectCollection_GetObjects
(
@@ -853,13 +864,16 @@ nssPKIObjectCollection_GetObjects
PRUint32 i = 0;
PRCList *link = PR_NEXT_LINK(&collection->head);
pkiObjectCollectionNode *node;
- while (link != &collection->head) {
+ while ((i < rvSize) && (link != &collection->head)) {
node = (pkiObjectCollectionNode *)link;
if (!node->haveObject) {
/* Convert the proto-object to an object */
node->object = (*collection->createObject)(node->object);
if (!node->object) {
- return PR_FAILURE;
+ link = PR_NEXT_LINK(link);
+ /*remove bogus object from list*/
+ nssPKIObjectCollection_RemoveNode(collection,node);
+ continue;
}
node->haveObject = PR_TRUE;
}
@@ -884,7 +898,10 @@ nssPKIObjectCollection_Traverse
if (!node->haveObject) {
node->object = (*collection->createObject)(node->object);
if (!node->object) {
- return PR_FAILURE;
+ link = PR_NEXT_LINK(link);
+ /*remove bogus object from list*/
+ nssPKIObjectCollection_RemoveNode(collection,node);
+ continue;
}
node->haveObject = PR_TRUE;
}
@@ -926,6 +943,8 @@ nssPKIObjectCollection_AddInstanceAsObject
if (!node->haveObject) {
node->object = (*collection->createObject)(node->object);
if (!node->object) {
+ /*remove bogus object from list*/
+ nssPKIObjectCollection_RemoveNode(collection,node);
return PR_FAILURE;
}
node->haveObject = PR_TRUE;