[PATCH 2/2] user32: Use FIELD_OFFSET to calculate the size of a struct with variable length array

Michael Stefaniuc mstefani at redhat.de
Wed Oct 24 03:26:02 CDT 2012


---
 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 )
-- 
1.7.7.6



More information about the wine-patches mailing list