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

This commit is contained in:
Michael Stefaniuc 2012-11-12 10:39:45 +01:00 committed by Alexandre Julliard
parent 47d2f3caf5
commit 96e428cc9e
1 changed files with 2 additions and 1 deletions

View File

@ -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 );