Skip to content

Commit

Permalink
Don't overwrite array bounds when mass storage device reports > 2 LUNs
Browse files Browse the repository at this point in the history
  • Loading branch information
robertfisk committed Apr 28, 2018
1 parent f3117a3 commit 0a77b5c
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,10 @@ static USBH_StatusTypeDef USBH_MSC_ClassRequest(USBH_HandleTypeDef *phost)
MSC_Handle->max_lun = (uint8_t )(MSC_Handle->max_lun) + 1;
USBH_UsrLog ("Number of supported LUN: %lu", (int32_t)(MSC_Handle->max_lun));

if (MSC_Handle->max_lun > MAX_SUPPORTED_LUN)
{
MSC_Handle->max_lun = MAX_SUPPORTED_LUN;
}
for(i = 0; i < MSC_Handle->max_lun; i++)
{
MSC_Handle->unit[i].prev_ready_state = USBH_FAIL;
Expand Down

0 comments on commit 0a77b5c

Please sign in to comment.