[Wine-patches] [eterhack 2/2] mountmgr.sys: SetupDiGetDeviceInstanceIdW takes number of characters, not bytes as the size of target buffer. (eterbug #10853).

Dmitry Timoshkov dtimoshkov на etersoft.ru
Пн Ноя 9 08:12:26 MSK 2015


This patch fixes another heap corruption.
---
 dlls/mountmgr.sys/device.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/mountmgr.sys/device.c b/dlls/mountmgr.sys/device.c
index 227b49f..47e0e20 100644
--- a/dlls/mountmgr.sys/device.c
+++ b/dlls/mountmgr.sys/device.c
@@ -821,8 +821,8 @@ static void register_usbstor_device( struct dos_drive *drive, const char *vendor
     devInfo.cbSize = sizeof(SP_DEVINFO_DATA);
     while (!found && SetupDiEnumDeviceInfo( set, i++, &devInfo ))
     {
-        size = (strlenW(devnameW) + 1) * sizeof(WCHAR);
-        device_idW = RtlAllocateHeap( GetProcessHeap(), 0, size );
+        size = strlenW(devnameW) + 1;
+        device_idW = RtlAllocateHeap( GetProcessHeap(), 0, size * sizeof(WCHAR) );
         if (!device_idW) goto done;
         ret = SetupDiGetDeviceInstanceIdW( set, &devInfo, device_idW, size, NULL );
         if (ret)
-- 
2.6.2



Подробная информация о списке рассылки Wine-patches