Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/hidclass.sys/device.c | 7 ++++++- dlls/ntoskrnl.exe/tests/ntoskrnl.c | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/dlls/hidclass.sys/device.c b/dlls/hidclass.sys/device.c index b8e3061b274..344d8b5d8e8 100644 --- a/dlls/hidclass.sys/device.c +++ b/dlls/hidclass.sys/device.c @@ -499,7 +499,12 @@ NTSTATUS WINAPI pdo_ioctl(DEVICE_OBJECT *device, IRP *irp) BYTE *buffer = MmGetSystemAddressForMdlSafe(irp->MdlAddress, NormalPagePriority); ULONG out_length;
- if (!irpsp->Parameters.DeviceIoControl.OutputBufferLength || !buffer) + if (!buffer) + { + irp->IoStatus.Status = STATUS_INVALID_USER_BUFFER; + break; + } + if (!irpsp->Parameters.DeviceIoControl.OutputBufferLength) { irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL; break; diff --git a/dlls/ntoskrnl.exe/tests/ntoskrnl.c b/dlls/ntoskrnl.exe/tests/ntoskrnl.c index 892e839fa56..3c883edb7c8 100644 --- a/dlls/ntoskrnl.exe/tests/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/tests/ntoskrnl.c @@ -2441,7 +2441,7 @@ static void test_hidp(HANDLE file, HANDLE async_file, int report_id, BOOL polled SetLastError(0xdeadbeef); ret = HidD_GetInputReport(file, report, 0); ok(!ret, "HidD_GetInputReport succeeded\n"); - todo_wine ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "HidD_GetInputReport returned error %u\n", GetLastError()); + ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "HidD_GetInputReport returned error %u\n", GetLastError());
SetLastError(0xdeadbeef); ret = HidD_GetInputReport(file, report, caps.InputReportByteLength - 1);