From 303c42901a24e3e935818bca9720f5f0f012ebd7 Mon Sep 17 00:00:00 2001 From: Conor Patrick Date: Mon, 15 Jul 2019 11:32:02 -0400 Subject: [PATCH] limit length of wLength --- targets/stm32l432/lib/usbd/usbd_hid.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/targets/stm32l432/lib/usbd/usbd_hid.c b/targets/stm32l432/lib/usbd/usbd_hid.c index bf329119..c96436bf 100644 --- a/targets/stm32l432/lib/usbd/usbd_hid.c +++ b/targets/stm32l432/lib/usbd/usbd_hid.c @@ -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) { @@ -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);