From 6ab9396d86af60016c40fd5effe0b43cc8f8ea28 Mon Sep 17 00:00:00 2001 From: Juan Lang Date: Mon, 1 Oct 2007 16:04:34 -0700 Subject: [PATCH] Don't check decoded length against encoded length for indefinite-form sequences --- dlls/crypt32/decode.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/dlls/crypt32/decode.c b/dlls/crypt32/decode.c index 082c28a..7bba04b 100644 --- a/dlls/crypt32/decode.c +++ b/dlls/crypt32/decode.c @@ -467,10 +467,14 @@ static BOOL CRYPT_AsnDecodeSequence(stru { DWORD lenBytes = GET_LEN_BYTES(pbEncoded[1]), cbDecoded; const BYTE *ptr = pbEncoded + 1 + lenBytes; + BOOL indefinite = FALSE; cbEncoded -= 1 + lenBytes; if (dataLen == CMSG_INDEFINITE_LENGTH) + { dataLen = cbEncoded; + indefinite = TRUE; + } else if (cbEncoded < dataLen) { TRACE("dataLen %d exceeds cbEncoded %d, failing\n", dataLen, @@ -501,7 +505,7 @@ static BOOL CRYPT_AsnDecodeSequence(stru cbDecoded += 2; } } - if (ret && cbDecoded != dataLen) + if (ret && !indefinite && cbDecoded != dataLen) { TRACE("expected %d decoded, got %d, failing\n", dataLen, cbDecoded); -- 1.4.1