Commit d5d3efd5 authored by Alexandre Julliard's avatar Alexandre Julliard

crypt32: Fix a couple of assumptions about structure layout.

parent 72a95ffa
......@@ -523,7 +523,7 @@ static BOOL CRYPT_AsnDecodeSequence(struct AsnDecodeSequenceItem items[],
for (i = 0; i < cItem; i++)
{
bytesNeeded += items[i].size;
structSize += items[i].minSize;
structSize = max( structSize, items[i].offset + items[i].minSize );
}
if (pcbDecoded)
*pcbDecoded = 1 + lenBytes + cbDecoded;
......
......@@ -564,13 +564,12 @@ static BOOL WINAPI CRYPT_AsnEncodeCRLEntries(DWORD dwCertEncodingType,
LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags,
PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
{
DWORD cCRLEntry = *(const DWORD *)pvStructInfo;
DWORD bytesNeeded, dataLen, lenBytes, i;
const CRL_ENTRY *rgCRLEntry = *(const CRL_ENTRY *const *)
((const BYTE *)pvStructInfo + sizeof(DWORD));
const CRL_INFO *info = pvStructInfo;
const CRL_ENTRY *rgCRLEntry = info->rgCRLEntry;
BOOL ret = TRUE;
for (i = 0, dataLen = 0; ret && i < cCRLEntry; i++)
for (i = 0, dataLen = 0; ret && i < info->cCRLEntry; i++)
{
DWORD size;
......@@ -594,7 +593,7 @@ static BOOL WINAPI CRYPT_AsnEncodeCRLEntries(DWORD dwCertEncodingType,
*pbEncoded++ = ASN_SEQUENCEOF;
CRYPT_EncodeLen(dataLen, pbEncoded, &lenBytes);
pbEncoded += lenBytes;
for (i = 0; i < cCRLEntry; i++)
for (i = 0; i < info->cCRLEntry; i++)
{
DWORD size = dataLen;
......@@ -659,7 +658,7 @@ static BOOL WINAPI CRYPT_AsnEncodeCRLInfo(DWORD dwCertEncodingType,
}
if (info->cCRLEntry)
{
items[cItem].pvStructInfo = &info->cCRLEntry;
items[cItem].pvStructInfo = info;
items[cItem].encodeFunc = CRYPT_AsnEncodeCRLEntries;
cItem++;
}
......
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