From 8ab1fc5ff795a0f0a71e7779ca8f563c62198d5d Mon Sep 17 00:00:00 2001 From: Michael Stefaniuc Date: Wed, 24 Oct 2012 10:26:02 +0200 Subject: [PATCH] user32: Use FIELD_OFFSET to calculate the size of a struct with variable length array. --- dlls/user32/cursoricon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/user32/cursoricon.c b/dlls/user32/cursoricon.c index 62afa3d42a1..8f6f9ce7b50 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 )