Do not pass an invalid target buffer info to WideCharToMultiByte

Dmitry Timoshkov dmitry at baikal.ru
Wed May 11 21:46:57 CDT 2005


Hello,

as reported by Dustin Navea.

Changelog:
    Dmitry Timoshkov <dmitry at codeweavers.com>
    Do not pass an invalid target buffer info to WideCharToMultiByte.

--- cvs/hq/wine/dlls/x11drv/clipboard.c	Fri Apr 22 02:55:20 2005
+++ wine/dlls/x11drv/clipboard.c	Thu May 12 02:40:57 2005
@@ -373,9 +373,9 @@ static void intern_atoms(void)
 
     for (format = ClipFormats, i = 0; format; format = format->NextFormat) {
         if (!format->drvData) {
-            len = WideCharToMultiByte(CP_UNIXCP, 0, format->Name, -1, NULL, -1, 0, 0);
-            names[i] = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
-            WideCharToMultiByte(CP_UNIXCP, 0, format->Name, -1, names[i++], len, 0, 0);
+            len = WideCharToMultiByte(CP_UNIXCP, 0, format->Name, -1, NULL, 0, NULL, NULL);
+            names[i] = HeapAlloc(GetProcessHeap(), 0, len);
+            WideCharToMultiByte(CP_UNIXCP, 0, format->Name, -1, names[i++], len, NULL, NULL);
         }
     }
 






More information about the wine-patches mailing list