Commit aaf908ab authored by Alexandre Julliard's avatar Alexandre Julliard

setupapi: Fix a structure size check for 64-bit.

parent fdf191a9
...@@ -2916,8 +2916,7 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailA( ...@@ -2916,8 +2916,7 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailA(
{ {
struct DeviceInfoSet *set = DeviceInfoSet; struct DeviceInfoSet *set = DeviceInfoSet;
struct InterfaceInfo *info; struct InterfaceInfo *info;
DWORD bytesNeeded = offsetof(SP_DEVICE_INTERFACE_DETAIL_DATA_A, DevicePath) DWORD bytesNeeded = FIELD_OFFSET(SP_DEVICE_INTERFACE_DETAIL_DATA_A, DevicePath[1]);
+ 1;
BOOL ret = FALSE; BOOL ret = FALSE;
TRACE("(%p, %p, %p, %d, %p, %p)\n", DeviceInfoSet, TRACE("(%p, %p, %p, %d, %p, %p)\n", DeviceInfoSet,
...@@ -2937,8 +2936,8 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailA( ...@@ -2937,8 +2936,8 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailA(
SetLastError(ERROR_INVALID_PARAMETER); SetLastError(ERROR_INVALID_PARAMETER);
return FALSE; return FALSE;
} }
if (DeviceInterfaceDetailData && (DeviceInterfaceDetailData->cbSize != if (DeviceInterfaceDetailData &&
offsetof(SP_DEVICE_INTERFACE_DETAIL_DATA_A, DevicePath) + sizeof(char))) DeviceInterfaceDetailData->cbSize != sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_A))
{ {
SetLastError(ERROR_INVALID_USER_BUFFER); SetLastError(ERROR_INVALID_USER_BUFFER);
return FALSE; return FALSE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment