From 6b8b82ef13d10bbdc790e72ce1d01e1bd94169d0 Mon Sep 17 00:00:00 2001 From: James Hawkins Date: Wed, 2 Dec 2009 17:28:48 -0800 Subject: [PATCH] msi: ExpandEnvironmentStringsW returns the required size in characters, so multiply the required size by sizeof(WCHAR) when allocating the buffer. --- dlls/msi/automation.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/msi/automation.c b/dlls/msi/automation.c index b443257bac1..3b6dd2debe2 100644 --- a/dlls/msi/automation.c +++ b/dlls/msi/automation.c @@ -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());