Michael Stefaniuc : user.exe16: Use FIELD_OFFSET to calculate the size of a struct with variable length array .
Alexandre Julliard
julliard at winehq.org
Mon Nov 12 14:14:40 CST 2012
Module: wine
Branch: master
Commit: 96e428cc9e30b45ce3c7ea3075dd25816f748f40
URL: http://source.winehq.org/git/wine.git/?a=commit;h=96e428cc9e30b45ce3c7ea3075dd25816f748f40
Author: Michael Stefaniuc <mstefani at redhat.de>
Date: Mon Nov 12 10:39:45 2012 +0100
user.exe16: Use FIELD_OFFSET to calculate the size of a struct with variable length array.
---
dlls/user.exe16/user.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/dlls/user.exe16/user.c b/dlls/user.exe16/user.c
index 7f184a2..b99c0ad 100644
--- a/dlls/user.exe16/user.c
+++ b/dlls/user.exe16/user.c
@@ -1320,7 +1320,8 @@ BOOL16 WINAPI GrayString16( HDC16 hdc, HBRUSH16 hbr, GRAYSTRINGPROC16 gsprc,
struct gray_string_info *info;
if (!cch) cch = strlen(str16);
- if (!(info = HeapAlloc( GetProcessHeap(), 0, sizeof(*info) + cch ))) return FALSE;
+ info = HeapAlloc( GetProcessHeap(), 0, FIELD_OFFSET( struct gray_string_info, str[cch] ));
+ if (!info) return FALSE;
info->proc = gsprc;
info->param = lParam;
memcpy( info->str, str16, cch );
More information about the wine-cvs
mailing list