msi: ExpandEnvironmentStringsW returns the required size in characters, so multiply the required size by sizeof(WCHAR) when allocating the buffer.

oldstable
James Hawkins 2009-12-02 17:28:48 -08:00 committed by Alexandre Julliard
parent 9ac7949810
commit 6b8b82ef13
1 changed files with 1 additions and 1 deletions

View File

@ -1498,7 +1498,7 @@ static void variant_from_registry_value(VARIANT *pVarResult, DWORD dwType, LPBYT
case REG_EXPAND_SZ:
if (!(dwNewSize = ExpandEnvironmentStringsW(szString, szNewString, dwNewSize)))
ERR("ExpandEnvironmentStrings returned error %d\n", GetLastError());
else if (!(szNewString = msi_alloc(dwNewSize)))
else if (!(szNewString = msi_alloc(dwNewSize * sizeof(WCHAR))))
ERR("Out of memory\n");
else if (!(dwNewSize = ExpandEnvironmentStringsW(szString, szNewString, dwNewSize)))
ERR("ExpandEnvironmentStrings returned error %d\n", GetLastError());