usb: device_next: fix null pointer dereference in Get Interface
Respond with a Request Error in default and addressed states. Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
This commit is contained in:
parent
468ce19e9c
commit
1a5ab2c16e
1 changed files with 6 additions and 0 deletions
|
@ -858,7 +858,13 @@ static int sreq_get_interface(struct usbd_context *const uds_ctx,
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* Treat as error in default (not specified) and addressed states. */
|
||||
cfg_nd = usbd_config_get_current(uds_ctx);
|
||||
if (cfg_nd == NULL) {
|
||||
errno = -EPERM;
|
||||
return 0;
|
||||
}
|
||||
|
||||
cfg_desc = cfg_nd->desc;
|
||||
|
||||
if (setup->wIndex > UINT8_MAX ||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue