Fix bad memory allocation for unicode buffer.
authorRolf Kalbermatter <rolf.kalbermatter@citeng.com>
Wed, 27 Oct 2004 21:18:35 +0000 (21:18 +0000)
committerAlexandre Julliard <julliard@winehq.org>
Wed, 27 Oct 2004 21:18:35 +0000 (21:18 +0000)
dlls/shell32/shlfileop.c

index cfbdf1a5ebd9e52a120e0150c2783eec12d01c14..c586d8fc21a325da16fdea93958434da3d9a622c 100644 (file)
@@ -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);