Juan Lang : crypt32: Explicitly pass pointers to blob arrays rather than relying on an invalid alignment assumption .
Alexandre Julliard
julliard at winehq.org
Mon Oct 19 09:56:06 CDT 2009
Module: wine
Branch: master
Commit: 1437d7ccc2b69de5c09e6a857d4b0bfa1a0ef56a
URL: http://source.winehq.org/git/wine.git/?a=commit;h=1437d7ccc2b69de5c09e6a857d4b0bfa1a0ef56a
Author: Juan Lang <juan.lang at gmail.com>
Date: Thu Oct 15 16:25:03 2009 -0700
crypt32: Explicitly pass pointers to blob arrays rather than relying on an invalid alignment assumption.
---
dlls/crypt32/msg.c | 20 ++++++++------------
1 files changed, 8 insertions(+), 12 deletions(-)
diff --git a/dlls/crypt32/msg.c b/dlls/crypt32/msg.c
index b91e185..825b6da 100644
--- a/dlls/crypt32/msg.c
+++ b/dlls/crypt32/msg.c
@@ -742,19 +742,13 @@ static BOOL CRYPT_ConstructBlobArray(DWORD *outCBlobs,
return ret;
}
-typedef struct _BlobArray
-{
- DWORD cBlobs;
- PCRYPT_DATA_BLOB blobs;
-} BlobArray;
-
-static void CRYPT_FreeBlobArray(BlobArray *array)
+static void CRYPT_FreeBlobArray(DWORD cBlobs, PCRYPT_DATA_BLOB blobs)
{
DWORD i;
- for (i = 0; i < array->cBlobs; i++)
- CryptMemFree(array->blobs[i].pbData);
- CryptMemFree(array->blobs);
+ for (i = 0; i < cBlobs; i++)
+ CryptMemFree(blobs[i].pbData);
+ CryptMemFree(blobs);
}
static BOOL CRYPT_ConstructAttribute(CRYPT_ATTRIBUTE *out,
@@ -1180,8 +1174,10 @@ static void CSignedEncodeMsg_Close(HCRYPTMSG hCryptMsg)
CryptMemFree(msg->innerOID);
CryptMemFree(msg->data.pbData);
- CRYPT_FreeBlobArray((BlobArray *)&msg->msg_data.info->cCertEncoded);
- CRYPT_FreeBlobArray((BlobArray *)&msg->msg_data.info->cCrlEncoded);
+ CRYPT_FreeBlobArray(msg->msg_data.info->cCertEncoded,
+ 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++)
CSignerInfo_Free(&msg->msg_data.info->rgSignerInfo[i]);
CSignedMsgData_CloseHandles(&msg->msg_data);
More information about the wine-cvs
mailing list