From 112e0e00dde115f1e468e880eb4fb41eee0e8b2d Mon Sep 17 00:00:00 2001 From: "julien.pierre.bugs%sun.com" Date: Mon, 31 Oct 2005 18:34:42 +0000 Subject: [PATCH] Fix for 314115 - QuickDER modifies SECItem.type while decoding. r=wtchang git-svn-id: svn://10.0.0.236/trunk@183274 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/security/nss/lib/util/quickder.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/mozilla/security/nss/lib/util/quickder.c b/mozilla/security/nss/lib/util/quickder.c index 33b25127221..29a5821476f 100644 --- a/mozilla/security/nss/lib/util/quickder.c +++ b/mozilla/security/nss/lib/util/quickder.c @@ -113,12 +113,9 @@ static SECStatus GetItem(SECItem* src, SECItem* dest, PRBool includeTag) /* reaching the end of the buffer is not an error */ dest->data = NULL; dest->len = 0; - dest->type = siBuffer; - return SECSuccess; } - dest->type = siBuffer; dest->data = definite_length_decoder(src->data, src->len, &dest->len, includeTag); if (dest->data == NULL) @@ -862,7 +859,12 @@ static SECStatus DecodeItem(void* dest, SECItem* destItem = (SECItem*) ((char*)dest + templateEntry->offset); if (destItem) { - *(destItem) = temp; + /* we leave the type alone in the destination SECItem. + If part of the destination was allocated by the decoder, in + cases of POINTER, SET OF and SEQUENCE OF, then type is set to + siBuffer due to the use of PORT_ArenaZAlloc*/ + destItem->data = temp.data; + destItem->len = temp.len; } else {