wintrust: Correct alignment for 64-bit
Juan Lang
juan.lang at gmail.com
Fri Aug 7 10:58:38 CDT 2009
--Juan
-------------- next part --------------
From 0019a2f8c2b34f45ced80befab38fd17d5a295ff Mon Sep 17 00:00:00 2001
From: Juan Lang <juan.lang at gmail.com>
Date: Fri, 7 Aug 2009 08:59:12 -0700
Subject: [PATCH 10/10] Correct alignment for 64-bit
---
dlls/wintrust/asn.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/dlls/wintrust/asn.c b/dlls/wintrust/asn.c
index ec5c4de..002eab5 100644
--- a/dlls/wintrust/asn.c
+++ b/dlls/wintrust/asn.c
@@ -1465,6 +1465,10 @@ struct AsnDecodeSequenceItem
DWORD size;
};
+/* Align up to a DWORD_PTR boundary
+ */
+#define ALIGN_DWORD_PTR(x) (((x) + sizeof(DWORD_PTR) - 1) & ~(sizeof(DWORD_PTR) - 1))
+
/* Decodes the items in a sequence, where the items are described in items,
* the encoded data are in pbEncoded with length cbEncoded. Decodes into
* pvStructInfo. nextData is a pointer to the memory location at which the
@@ -1517,9 +1521,7 @@ static BOOL CRYPT_AsnDecodeSequenceItems(DWORD dwCertEncodingType,
if (ret)
{
/* Account for alignment padding */
- if (items[i].size % sizeof(DWORD))
- items[i].size += sizeof(DWORD) -
- items[i].size % sizeof(DWORD);
+ items[i].size = ALIGN_DWORD_PTR(items[i].size);
TRACE("item %d size: %d\n", i, items[i].size);
if (nextData && items[i].hasPointer &&
items[i].size > items[i].minSize)
--
1.6.3.2
More information about the wine-patches
mailing list