Corrently build the array of pointers to parsed group members, even when

the group was empty.  Fixes bug 174885 and partially fixes 204555.
This commit is contained in:
nelsonb%netscape.com 2003-05-24 05:57:21 +00:00
parent fc20d83b46
commit 3051c7eb48

View File

@ -35,7 +35,7 @@
* Support for DEcoding ASN.1 data based on BER/DER (Basic/Distinguished
* Encoding Rules).
*
* $Id: secasn1d.c,v 1.25 2003/05/17 01:18:52 nelsonb%netscape.com Exp $
* $Id: secasn1d.c,v 1.26 2003/05/24 05:57:21 nelsonb%netscape.com Exp $
*/
/* #define DEBUG_ASN1D_STATES 1 */
@ -1062,10 +1062,9 @@ sec_asn1d_prepare_for_contents (sec_asn1d_state *state)
} else {
/*
* A group of zero; we are done.
* XXX Should we store a NULL here? Or set state to
* afterGroup and let that code do it?
* Set state to afterGroup and let that code plant the NULL.
*/
state->place = afterEndOfContents;
state->place = afterGroup;
}
return;
}
@ -2064,7 +2063,8 @@ sec_asn1d_concat_group (sec_asn1d_state *state)
PORT_Assert (state->place == afterGroup);
placep = (const void***)state->dest;
if (state->subitems_head != NULL) {
PORT_Assert(state->subitems_head == NULL || placep != NULL);
if (placep != NULL) {
struct subitem *item;
const void **group;
int count;
@ -2084,7 +2084,6 @@ sec_asn1d_concat_group (sec_asn1d_state *state)
return;
}
PORT_Assert (placep != NULL);
*placep = group;
item = state->subitems_head;
@ -2100,8 +2099,6 @@ sec_asn1d_concat_group (sec_asn1d_state *state)
* a memory leak (it is just temporarily left dangling).
*/
state->subitems_head = state->subitems_tail = NULL;
} else if (placep != NULL) {
*placep = NULL;
}
state->place = afterEndOfContents;