Commit 5b092877 authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

crypt32: Don't check decoded length against encoded length for indefinite-form sequences.

parent 127fd82a
...@@ -467,10 +467,14 @@ static BOOL CRYPT_AsnDecodeSequence(struct AsnDecodeSequenceItem items[], ...@@ -467,10 +467,14 @@ static BOOL CRYPT_AsnDecodeSequence(struct AsnDecodeSequenceItem items[],
{ {
DWORD lenBytes = GET_LEN_BYTES(pbEncoded[1]), cbDecoded; DWORD lenBytes = GET_LEN_BYTES(pbEncoded[1]), cbDecoded;
const BYTE *ptr = pbEncoded + 1 + lenBytes; const BYTE *ptr = pbEncoded + 1 + lenBytes;
BOOL indefinite = FALSE;
cbEncoded -= 1 + lenBytes; cbEncoded -= 1 + lenBytes;
if (dataLen == CMSG_INDEFINITE_LENGTH) if (dataLen == CMSG_INDEFINITE_LENGTH)
{
dataLen = cbEncoded; dataLen = cbEncoded;
indefinite = TRUE;
}
else if (cbEncoded < dataLen) else if (cbEncoded < dataLen)
{ {
TRACE("dataLen %d exceeds cbEncoded %d, failing\n", dataLen, TRACE("dataLen %d exceeds cbEncoded %d, failing\n", dataLen,
...@@ -501,7 +505,7 @@ static BOOL CRYPT_AsnDecodeSequence(struct AsnDecodeSequenceItem items[], ...@@ -501,7 +505,7 @@ static BOOL CRYPT_AsnDecodeSequence(struct AsnDecodeSequenceItem items[],
cbDecoded += 2; cbDecoded += 2;
} }
} }
if (ret && cbDecoded != dataLen) if (ret && !indefinite && cbDecoded != dataLen)
{ {
TRACE("expected %d decoded, got %d, failing\n", dataLen, TRACE("expected %d decoded, got %d, failing\n", dataLen,
cbDecoded); cbDecoded);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment