mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +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;
|
NumEndpoints = InterfaceDescriptor->bNumEndpoints;
|
||||||
|
|
||||||
Length = sizeof(USBD_INTERFACE_INFORMATION) +
|
Length = FIELD_OFFSET(USBD_INTERFACE_INFORMATION, Pipes) +
|
||||||
(NumEndpoints - 1) * sizeof(USBD_PIPE_INFORMATION);
|
NumEndpoints * sizeof(USBD_PIPE_INFORMATION);
|
||||||
|
|
||||||
if (InterfaceInfo->AlternateSetting && IsSetInterface)
|
if (InterfaceInfo->AlternateSetting && IsSetInterface)
|
||||||
{
|
{
|
||||||
|
@ -289,8 +289,8 @@ USBPORT_OpenInterface(IN PURB Urb,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
HandleLength = sizeof(USBPORT_INTERFACE_HANDLE) +
|
HandleLength = FIELD_OFFSET(USBPORT_INTERFACE_HANDLE, PipeHandle) +
|
||||||
(NumEndpoints - 1) * sizeof(USBPORT_PIPE_HANDLE);
|
NumEndpoints * sizeof(USBPORT_PIPE_HANDLE);
|
||||||
|
|
||||||
InterfaceHandle = ExAllocatePoolWithTag(NonPagedPool,
|
InterfaceHandle = ExAllocatePoolWithTag(NonPagedPool,
|
||||||
HandleLength,
|
HandleLength,
|
||||||
|
@ -500,8 +500,8 @@ USBPORT_InitInterfaceInfo(IN PUSBD_INTERFACE_INFORMATION InterfaceInfo,
|
||||||
{
|
{
|
||||||
NumberOfPipes = Descriptor->bNumEndpoints;
|
NumberOfPipes = Descriptor->bNumEndpoints;
|
||||||
|
|
||||||
Length = sizeof(USBD_INTERFACE_INFORMATION) +
|
Length = FIELD_OFFSET(USBD_INTERFACE_INFORMATION, Pipes) +
|
||||||
(NumberOfPipes - 1) * sizeof(USBD_PIPE_INFORMATION);
|
NumberOfPipes * sizeof(USBD_PIPE_INFORMATION);
|
||||||
|
|
||||||
if (InterfaceInfo->Length >= Length)
|
if (InterfaceInfo->Length >= Length)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue