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

Alexandre Julliard julliard at winehq.org
Wed Oct 24 13:39:41 CDT 2012


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

Author: Michael Stefaniuc <mstefani at redhat.de>
Date:   Wed Oct 24 10:26:02 2012 +0200

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

---

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

diff --git a/dlls/user32/cursoricon.c b/dlls/user32/cursoricon.c
index 62afa3d..8f6f9ce 100644
--- a/dlls/user32/cursoricon.c
+++ b/dlls/user32/cursoricon.c
@@ -1330,7 +1330,7 @@ static HICON CURSORICON_LoadFromFile( LPCWSTR filename,
     }
 
     dir = (const CURSORICONFILEDIR*) bits;
-    if ( filesize < (sizeof(*dir) + sizeof(dir->idEntries[0])*(dir->idCount-1)) )
+    if ( filesize < FIELD_OFFSET( CURSORICONFILEDIR, idEntries[dir->idCount] ))
         goto end;
 
     if ( fCursor )




More information about the wine-cvs mailing list