From: Rolf Kalbermatter Date: Wed, 27 Oct 2004 21:18:35 +0000 (+0000) Subject: Fix bad memory allocation for unicode buffer. X-Git-Tag: wine-20041201~241 X-Git-Url: http://git.etersoft.ru/projects/?a=commitdiff_plain;h=87fb440e71d3e6bb59cf6f36756bba9c885ed6b9;p=wine%2Feterwine.git Fix bad memory allocation for unicode buffer. --- diff --git a/dlls/shell32/shlfileop.c b/dlls/shell32/shlfileop.c index cfbdf1a5eb..c586d8fc21 100644 --- a/dlls/shell32/shlfileop.c +++ b/dlls/shell32/shlfileop.c @@ -131,14 +131,14 @@ BOOL SHELL_ConfirmDialogW(int nKindOfDialog, LPCWSTR szDir) return (IDOK == MessageBoxW(GetActiveWindow(), szBuffer, szCaption, MB_OKCANCEL | MB_ICONEXCLAMATION)); } -static DWORD SHELL32_AnsiToUnicodeBuf(LPCSTR aPath, LPWSTR *wPath, DWORD minlen) +static DWORD SHELL32_AnsiToUnicodeBuf(LPCSTR aPath, LPWSTR *wPath, DWORD minChars) { DWORD len = MultiByteToWideChar(CP_ACP, 0, aPath, -1, NULL, 0); - if (len < minlen) - len = minlen; + if (len < minChars) + len = minChars; - *wPath = HeapAlloc(GetProcessHeap(), 0, len); + *wPath = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); if (*wPath) { MultiByteToWideChar(CP_ACP, 0, aPath, -1, *wPath, len);