From d1d6face36944ac58e0c61be3c2fdab4b3a72752 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20H=C3=B6glinger-Stelzer?= Date: Sun, 2 Sep 2018 15:02:21 +0200 Subject: [PATCH] Corrected returned error code --- sys/xusb.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/xusb.c b/sys/xusb.c index b9ac9ca..beb6045 100644 --- a/sys/xusb.c +++ b/sys/xusb.c @@ -608,6 +608,12 @@ NTSTATUS Xusb_GetUserIndex(WDFDEVICE Device, PXUSB_GET_USER_INDEX Request) Request->UserIndex = (ULONG)userIndex; status = STATUS_SUCCESS; } + else + { + // If the index is negative at this stage, we've exceeded XUSER_MAX_COUNT + // and need to fail this request with a distinct status. + status = STATUS_INVALID_DEVICE_OBJECT_PARAMETER; + } TraceEvents(TRACE_LEVEL_VERBOSE, TRACE_XUSB, "%!FUNC! Exit with status %!STATUS!", status);