Michael Stefaniuc : itss: Use FIELD_OFFSET to calculate the size of a struct with variable length array .

Alexandre Julliard julliard at winehq.org
Fri Nov 2 15:52:03 CDT 2012


Module: wine
Branch: master
Commit: 815031d8325482cd09d3387564df1587f14d60f6
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=815031d8325482cd09d3387564df1587f14d60f6

Author: Michael Stefaniuc <mstefani at redhat.de>
Date:   Fri Nov  2 15:17:06 2012 +0100

itss: Use FIELD_OFFSET to calculate the size of a struct with variable length array.

---

 dlls/itss/moniker.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/dlls/itss/moniker.c b/dlls/itss/moniker.c
index dedf4e5..0509c9e 100644
--- a/dlls/itss/moniker.c
+++ b/dlls/itss/moniker.c
@@ -354,7 +354,7 @@ static HRESULT ITS_IMoniker_create( IMoniker **ppObj, LPCWSTR name, DWORD n )
     DWORD sz;
 
     /* szFile[1] has space for one character already */
-    sz = sizeof(ITS_IMonikerImpl) + strlenW( name )*sizeof(WCHAR);
+    sz = FIELD_OFFSET( ITS_IMonikerImpl, szFile[strlenW( name ) + 1] );
 
     itsmon = HeapAlloc( GetProcessHeap(), 0, sz );
     itsmon->IMoniker_iface.lpVtbl = &ITS_IMonikerImpl_Vtbl;




More information about the wine-cvs mailing list