msiexec: 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:43:44 +01:00 committed by Alexandre Julliard
parent 96e428cc9e
commit b791c25274
1 changed files with 1 additions and 3 deletions

View File

@ -109,10 +109,8 @@ static BOOL IsProductCode(LPWSTR str)
static VOID StringListAppend(struct string_list **list, LPCWSTR str)
{
struct string_list *entry;
DWORD size;
size = sizeof *entry + lstrlenW(str) * sizeof (WCHAR);
entry = HeapAlloc(GetProcessHeap(), 0, size);
entry = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(struct string_list, str[lstrlenW(str) + 1]));
if(!entry)
{
WINE_ERR("Out of memory!\n");