Commit 96e428cc authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

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

parent 47d2f3ca
...@@ -1320,7 +1320,8 @@ BOOL16 WINAPI GrayString16( HDC16 hdc, HBRUSH16 hbr, GRAYSTRINGPROC16 gsprc, ...@@ -1320,7 +1320,8 @@ BOOL16 WINAPI GrayString16( HDC16 hdc, HBRUSH16 hbr, GRAYSTRINGPROC16 gsprc,
struct gray_string_info *info; struct gray_string_info *info;
if (!cch) cch = strlen(str16); 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->proc = gsprc;
info->param = lParam; info->param = lParam;
memcpy( info->str, str16, cch ); memcpy( info->str, str16, cch );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment