mirror of
https://github.com/CTCaer/hidapi.git
synced 2024-11-23 10:09:46 +00:00
Check libusb_get_active_config_descriptor return value
Avoids a crash if libusb_get_active_config_descriptor() returns with an error code.
This commit is contained in:
parent
025d81a5a3
commit
f9c06d35b2
@ -550,7 +550,8 @@ hid_device * HID_API_EXPORT hid_open_path(const char *path)
|
||||
int i,j,k;
|
||||
libusb_get_device_descriptor(usb_dev, &desc);
|
||||
|
||||
libusb_get_active_config_descriptor(usb_dev, &conf_desc);
|
||||
if (libusb_get_active_config_descriptor(usb_dev, &conf_desc) < 0)
|
||||
continue;
|
||||
for (j = 0; j < conf_desc->bNumInterfaces; j++) {
|
||||
const struct libusb_interface *intf = &conf_desc->interface[j];
|
||||
for (k = 0; k < intf->num_altsetting; k++) {
|
||||
|
Loading…
Reference in New Issue
Block a user