diff options
author | jpierre%netscape.com <devnull@localhost> | 2002-08-16 00:05:55 +0000 |
---|---|---|
committer | jpierre%netscape.com <devnull@localhost> | 2002-08-16 00:05:55 +0000 |
commit | ea8a5fd53be989cf43c51f745c20543527b886af (patch) | |
tree | ca49da3f6de57173179e27215db686ad93265ea6 /security/nss/lib/util | |
parent | 8732e39e907f6566d3caa691ff99623c639e9c29 (diff) | |
download | nss-hg-ea8a5fd53be989cf43c51f745c20543527b886af.tar.gz |
Correctly count the number of items in a SEQUENCE OF or SET OF in quickder decoder. Bug found by one of Terry's tests.
Diffstat (limited to 'security/nss/lib/util')
-rw-r--r-- | security/nss/lib/util/quickder.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/security/nss/lib/util/quickder.c b/security/nss/lib/util/quickder.c index 82c158113..32c47ed89 100644 --- a/security/nss/lib/util/quickder.c +++ b/security/nss/lib/util/quickder.c @@ -541,8 +541,8 @@ static SECStatus DecodeGroup(void* dest, do { SECItem anitem; - rv = GetItem(&counter, &anitem, PR_FALSE); - if (SECSuccess == rv) + rv = GetItem(&counter, &anitem, PR_TRUE); + if (SECSuccess == rv && (anitem.len) ) { totalEntries++; } @@ -582,7 +582,11 @@ static SECStatus DecodeGroup(void* dest, if (SECSuccess == rv && totalEntries) do { - PR_ASSERT(entryIndex<totalEntries); + if (!(entryIndex<totalEntries)) + { + rv = SECFailure; + break; + } rv = DecodeItem(entries[entryIndex++], subTemplate, &group, arena, PR_TRUE); } while ( (SECSuccess == rv) && (group.len) ); /* we should be at the end of the set by now */ |