https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3baf43c5def76d2b30bc32...
commit 3baf43c5def76d2b30bc32f5792c110c3e90e686 Author: Vadim Galyant vgal@rambler.ru AuthorDate: Sat Sep 8 20:52:06 2018 +0200 Commit: Thomas Faber thomas.faber@reactos.org CommitDate: Sun Sep 9 11:24:48 2018 +0200
[USBHUB_NEW][USBPORT] Fix buffer size calculation for multi-sz values in IRP_MN_QUERY_ID.
Also fix some copypasta'd DPRINTs. --- drivers/usb/usbhub_new/pnp.c | 8 ++++---- drivers/usb/usbport/pnp.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/usb/usbhub_new/pnp.c b/drivers/usb/usbhub_new/pnp.c index 16cd2b17b9..c1862574b0 100644 --- a/drivers/usb/usbhub_new/pnp.c +++ b/drivers/usb/usbhub_new/pnp.c @@ -1649,7 +1649,7 @@ USBH_PdoQueryId(IN PUSBHUB_PORT_PDO_EXTENSION PortExtension, DeviceDescriptor->idProduct); }
- Length = sizeof(Buffer) - (Remaining - sizeof(UNICODE_NULL)); + Length = sizeof(Buffer) - (Remaining - 2 * sizeof(UNICODE_NULL));
Id = ExAllocatePoolWithTag(PagedPool, Length, USB_HUB_TAG);
@@ -1662,7 +1662,7 @@ USBH_PdoQueryId(IN PUSBHUB_PORT_PDO_EXTENSION PortExtension,
if (PortExtension->PortPdoFlags & USBHUB_PDO_FLAG_INIT_PORT_FAILED) { - DPRINT("USBH_PdoQueryId: BusQueryInstanceID - %S\n", Id); + DPRINT("USBH_PdoQueryId: BusQueryHardwareID - %S\n", Id); } else { @@ -1766,7 +1766,7 @@ USBH_PdoQueryId(IN PUSBHUB_PORT_PDO_EXTENSION PortExtension, InterfaceDescriptor->bInterfaceClass); }
- Length = sizeof(Buffer) - (Remaining - sizeof(UNICODE_NULL)); + Length = sizeof(Buffer) - (Remaining - 2 * sizeof(UNICODE_NULL));
Id = ExAllocatePoolWithTag(PagedPool, Length, USB_HUB_TAG);
@@ -1779,7 +1779,7 @@ USBH_PdoQueryId(IN PUSBHUB_PORT_PDO_EXTENSION PortExtension,
if (PortExtension->PortPdoFlags & USBHUB_PDO_FLAG_INIT_PORT_FAILED) { - DPRINT("USBH_PdoQueryId: BusQueryInstanceID - %S\n", Id); + DPRINT("USBH_PdoQueryId: BusQueryCompatibleID - %S\n", Id); } else { diff --git a/drivers/usb/usbport/pnp.c b/drivers/usb/usbport/pnp.c index 4e7a545b27..545b75e820 100644 --- a/drivers/usb/usbport/pnp.c +++ b/drivers/usb/usbport/pnp.c @@ -1493,7 +1493,7 @@ USBPORT_GetDeviceHwIds(IN PDEVICE_OBJECT FdoDevice, L"USB\ROOT_HUB"); }
- Length = (sizeof(Buffer) - Remaining + sizeof(UNICODE_NULL)); + Length = (sizeof(Buffer) - Remaining + 2 * sizeof(UNICODE_NULL));
/* for debug only */ if (FALSE)