crypt32: Fix a couple of assumptions about structure layout.

This commit is contained in:
Alexandre Julliard 2009-06-22 14:53:24 +02:00
parent 72a95ffa22
commit d5d3efd592
2 changed files with 6 additions and 7 deletions

View File

@ -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;

View File

@ -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++;
}