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

Dmitry Timoshkov dtimoshkov на etersoft.ru
Чт Ноя 5 12:07:55 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 e265665..532a2eb 100644
--- a/dlls/mountmgr.sys/device.c
+++ b/dlls/mountmgr.sys/device.c
@@ -819,8 +819,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