From 96e428cc9e30b45ce3c7ea3075dd25816f748f40 Mon Sep 17 00:00:00 2001 From: Michael Stefaniuc Date: Mon, 12 Nov 2012 10:39:45 +0100 Subject: [PATCH] user.exe16: Use FIELD_OFFSET to calculate the size of a struct with variable length array. --- dlls/user.exe16/user.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dlls/user.exe16/user.c b/dlls/user.exe16/user.c index 7f184a2166d..b99c0ad0714 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 );