Skip to content

Commit

Permalink
Merge pull request #224 from solokeys/fault_tolerance
Browse files Browse the repository at this point in the history
limit length of wLength
  • Loading branch information
conorpp authored Jul 27, 2019
2 parents 235785b + 303c429 commit 9ead11d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions targets/stm32l432/lib/usbd/usbd_hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ static uint8_t USBD_HID_Setup (USBD_HandleTypeDef *pdev,
uint8_t *pbuf = NULL;
uint16_t status_info = 0U;
USBD_StatusTypeDef ret = USBD_OK;
req->wLength = req->wLength & 0x7f;

switch (req->bmRequest & USB_REQ_TYPE_MASK)
{
Expand Down Expand Up @@ -386,6 +387,7 @@ static uint8_t USBD_HID_Setup (USBD_HandleTypeDef *pdev,
break;

case USB_REQ_GET_DESCRIPTOR:
req->wLength = req->wLength & 0x7f;
if(req->wValue >> 8 == HID_REPORT_DESC)
{
len = MIN(HID_FIDO_REPORT_DESC_SIZE , req->wLength);
Expand Down

0 comments on commit 9ead11d

Please sign in to comment.