crypt32: Explicitly pass pointers to blob arrays rather than relying on an invalid alignment assumption.

This commit is contained in:
Juan Lang 2009-10-15 16:25:03 -07:00 committed by Alexandre Julliard
parent 3000bc200a
commit 1437d7ccc2
1 changed files with 8 additions and 12 deletions

View File

@ -742,19 +742,13 @@ static BOOL CRYPT_ConstructBlobArray(DWORD *outCBlobs,
return ret; return ret;
} }
typedef struct _BlobArray static void CRYPT_FreeBlobArray(DWORD cBlobs, PCRYPT_DATA_BLOB blobs)
{
DWORD cBlobs;
PCRYPT_DATA_BLOB blobs;
} BlobArray;
static void CRYPT_FreeBlobArray(BlobArray *array)
{ {
DWORD i; DWORD i;
for (i = 0; i < array->cBlobs; i++) for (i = 0; i < cBlobs; i++)
CryptMemFree(array->blobs[i].pbData); CryptMemFree(blobs[i].pbData);
CryptMemFree(array->blobs); CryptMemFree(blobs);
} }
static BOOL CRYPT_ConstructAttribute(CRYPT_ATTRIBUTE *out, static BOOL CRYPT_ConstructAttribute(CRYPT_ATTRIBUTE *out,
@ -1180,8 +1174,10 @@ static void CSignedEncodeMsg_Close(HCRYPTMSG hCryptMsg)
CryptMemFree(msg->innerOID); CryptMemFree(msg->innerOID);
CryptMemFree(msg->data.pbData); CryptMemFree(msg->data.pbData);
CRYPT_FreeBlobArray((BlobArray *)&msg->msg_data.info->cCertEncoded); CRYPT_FreeBlobArray(msg->msg_data.info->cCertEncoded,
CRYPT_FreeBlobArray((BlobArray *)&msg->msg_data.info->cCrlEncoded); msg->msg_data.info->rgCertEncoded);
CRYPT_FreeBlobArray(msg->msg_data.info->cCrlEncoded,
msg->msg_data.info->rgCrlEncoded);
for (i = 0; i < msg->msg_data.info->cSignerInfo; i++) for (i = 0; i < msg->msg_data.info->cSignerInfo; i++)
CSignerInfo_Free(&msg->msg_data.info->rgSignerInfo[i]); CSignerInfo_Free(&msg->msg_data.info->rgSignerInfo[i]);
CSignedMsgData_CloseHandles(&msg->msg_data); CSignedMsgData_CloseHandles(&msg->msg_data);