Michael Stefaniuc : mpr: Use offsetof for the size of structs with varlen arrays.
Module: wine Branch: master Commit: 3c3959cfd375667361197a5ab158429418f4eade URL: http://source.winehq.org/git/wine.git/?a=commit;h=3c3959cfd375667361197a5ab1... Author: Michael Stefaniuc <mstefani(a)redhat.de> Date: Tue Mar 5 09:36:24 2013 +0100 mpr: Use offsetof for the size of structs with varlen arrays. --- dlls/mpr/pwcache.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/mpr/pwcache.c b/dlls/mpr/pwcache.c index efd9c23..178d40f 100644 --- a/dlls/mpr/pwcache.c +++ b/dlls/mpr/pwcache.c @@ -298,8 +298,8 @@ UINT WINAPI WNetEnumCachedPasswords( continue; /* read the value data */ - size = sizeof *entry - sizeof entry->abResource[0] + val_sz + data_sz; - entry = HeapAlloc( GetProcessHeap(), 0, sizeof *entry + val_sz + data_sz ); + size = offsetof( PASSWORD_CACHE_ENTRY, abResource[val_sz + data_sz] ); + entry = HeapAlloc( GetProcessHeap(), 0, size ); memcpy( entry->abResource, val, val_sz ); entry->cbEntry = size; entry->cbResource = val_sz;
participants (1)
-
Alexandre Julliard