From 028a92e5f4336e3ff99ddef8ae581b116bba6a9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Fri, 3 May 2019 12:49:00 +0200 Subject: windows_winusb: Mask wIndex correctly when checking interfaces According to the USB 3.0 spec (9.3.4), the interface number is in the lower 8 bits of wIndex. Note that wIndex must not be modified because some (non-compliant?) devices actually use the higher 8 bits for custom data with recipient-interface requests. Closes #567 Signed-off-by: Nathan Hjelm --- libusb/os/windows_winusb.c | 2 +- libusb/version_nano.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libusb/os/windows_winusb.c b/libusb/os/windows_winusb.c index 423fb3d..e18a723 100644 --- a/libusb/os/windows_winusb.c +++ b/libusb/os/windows_winusb.c @@ -2474,7 +2474,7 @@ static int winusbx_submit_control_transfer(int sub_api, struct usbi_transfer *it return LIBUSB_ERROR_INVALID_PARAM; if ((setup->RequestType & 0x1F) == LIBUSB_RECIPIENT_INTERFACE) - current_interface = check_valid_interface(transfer->dev_handle, setup->Index, USB_API_WINUSBX); + current_interface = check_valid_interface(transfer->dev_handle, setup->Index & 0xff, USB_API_WINUSBX); else current_interface = get_valid_interface(transfer->dev_handle, USB_API_WINUSBX); if (current_interface < 0) { diff --git a/libusb/version_nano.h b/libusb/version_nano.h index 77a129a..971eaf4 100644 --- a/libusb/version_nano.h +++ b/libusb/version_nano.h @@ -1 +1 @@ -#define LIBUSB_NANO 11372 +#define LIBUSB_NANO 11373 -- cgit v1.2.1