usb_serial: fix possible NULL pointer dereference
There can apparently be interfaces without descriptors. Should fix #17892 Change-Id: Ibcbab0f60ecbd2005640c647bf7540d17d0f5375 Reviewed-on: https://review.haiku-os.org/c/haiku/+/5598 Tested-by: Commit checker robot <[email protected]> Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
@@ -30,7 +30,11 @@ ACMDevice::AddDevice(const usb_configuration_info *config)
|
||||
// Search ACM Communication Interface
|
||||
for (size_t i = 0; i < config->interface_count && status < B_OK; i++) {
|
||||
usb_interface_info *interface = config->interface[i].active;
|
||||
if (interface == NULL)
|
||||
continue;
|
||||
usb_interface_descriptor *descriptor = interface->descr;
|
||||
if (descriptor == NULL)
|
||||
continue;
|
||||
if (descriptor->interface_class != USB_CDC_COMMUNICATION_INTERFACE_CLASS
|
||||
|| descriptor->interface_subclass != USB_CDC_COMMUNICATION_INTERFACE_ACM_SUBCLASS)
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user