mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 09:34:43 +00:00
[USBPORT] Avoid more integer overflows.
This commit is contained in:
parent
a45779a12f
commit
bf74391dcd
1 changed files with 6 additions and 6 deletions
|
@ -275,8 +275,8 @@ USBPORT_OpenInterface(IN PURB Urb,
|
|||
|
||||
NumEndpoints = InterfaceDescriptor->bNumEndpoints;
|
||||
|
||||
Length = sizeof(USBD_INTERFACE_INFORMATION) +
|
||||
(NumEndpoints - 1) * sizeof(USBD_PIPE_INFORMATION);
|
||||
Length = FIELD_OFFSET(USBD_INTERFACE_INFORMATION, Pipes) +
|
||||
NumEndpoints * sizeof(USBD_PIPE_INFORMATION);
|
||||
|
||||
if (InterfaceInfo->AlternateSetting && IsSetInterface)
|
||||
{
|
||||
|
@ -289,8 +289,8 @@ USBPORT_OpenInterface(IN PURB Urb,
|
|||
}
|
||||
else
|
||||
{
|
||||
HandleLength = sizeof(USBPORT_INTERFACE_HANDLE) +
|
||||
(NumEndpoints - 1) * sizeof(USBPORT_PIPE_HANDLE);
|
||||
HandleLength = FIELD_OFFSET(USBPORT_INTERFACE_HANDLE, PipeHandle) +
|
||||
NumEndpoints * sizeof(USBPORT_PIPE_HANDLE);
|
||||
|
||||
InterfaceHandle = ExAllocatePoolWithTag(NonPagedPool,
|
||||
HandleLength,
|
||||
|
@ -500,8 +500,8 @@ USBPORT_InitInterfaceInfo(IN PUSBD_INTERFACE_INFORMATION InterfaceInfo,
|
|||
{
|
||||
NumberOfPipes = Descriptor->bNumEndpoints;
|
||||
|
||||
Length = sizeof(USBD_INTERFACE_INFORMATION) +
|
||||
(NumberOfPipes - 1) * sizeof(USBD_PIPE_INFORMATION);
|
||||
Length = FIELD_OFFSET(USBD_INTERFACE_INFORMATION, Pipes) +
|
||||
NumberOfPipes * sizeof(USBD_PIPE_INFORMATION);
|
||||
|
||||
if (InterfaceInfo->Length >= Length)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue