shell32: shlfileop, fix bad memory buffer allocation

Rolf Kalbermatter rolf.kalbermatter at citeng.com
Wed Oct 27 14:35:34 CDT 2004


Changelog
  - dlls/shell32/shlfileop.c
    Fix bad memory allocation for unicode buffer allocation

Rolf Kalbermatter

Index: shlfileop.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shlfileop.c,v
retrieving revision 1.47
diff -u -r1.47 shlfileop.c
--- shlfileop.c	22 Oct 2004 22:27:51 -0000	1.47
+++ shlfileop.c	27 Oct 2004 17:39:19 -0000
@@ -131,14 +131,14 @@
 	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);





More information about the wine-patches mailing list