This prevents a nasty out-of-bounds read and a likely crash when
the interface number is invalid.
Closes #568
Signed-off-by: Nathan Hjelm <hjelmn@me.com>
*/
static int check_valid_interface(struct libusb_device_handle *dev_handle, unsigned short interface, int api_id)
{
+ if (interface >= USB_MAXINTERFACES)
+ return -1;
+
struct winusb_device_handle_priv *handle_priv = _device_handle_priv(dev_handle);
struct winusb_device_priv *priv = _device_priv(dev_handle->dev);
-#define LIBUSB_NANO 11373
+#define LIBUSB_NANO 11374