Merge pull request #263 from mck1117/fix-msd-lun

don't deref null pointer on MSD LUN request
This commit is contained in:
Fabien Poussin 2021-02-24 20:27:49 +01:00 committed by GitHub
commit e7cdad3d1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -284,7 +284,8 @@ bool msd_request_hook(USBDriver *usbp) {
} else if (usbp->setup[0] == (USB_RTYPE_TYPE_CLASS | USB_RTYPE_RECIPIENT_INTERFACE | USB_RTYPE_DIR_DEV2HOST)
&& usbp->setup[1] == MSD_REQ_GET_MAX_LUN) {
/* Return the maximum supported LUN. */
usbSetupTransfer(usbp, 0, 1, NULL);
static uint8_t zero = 0;
usbSetupTransfer(usbp, &zero, 1, NULL);
return true;
/* OR */
/* Return false to stall to indicate that we don't support LUN */