summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2021-09-13 16:01:56 +0700
committerGitHub <[email protected]>2021-09-13 16:01:56 +0700
commit7e6f954ffe7e3e574d629540d694ac91e14c245d (patch)
tree5f3448c79233fda6da12172ba9a4c22f353fcff0 /src
parent501378898970adfe5f84885c12059c3ae8ee8b08 (diff)
parent50e3c0054f8d26340863667a50aae5a798f6aefc (diff)
Merge pull request #1090 from szymonh/master
Prevent buffer overflow in bth_device.c
Diffstat (limited to 'src')
-rwxr-xr-xsrc/class/bth/bth_device.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/class/bth/bth_device.c b/src/class/bth/bth_device.c
index 1d27ae7c5..b73f829cc 100755
--- a/src/class/bth/bth_device.c
+++ b/src/class/bth/bth_device.c
@@ -214,14 +214,14 @@ bool btd_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_request_t c
}
else return false;
- return tud_control_xfer(rhport, request, &_btd_itf.hci_cmd, request->wLength);
+ return tud_control_xfer(rhport, request, &_btd_itf.hci_cmd, sizeof(_btd_itf.hci_cmd));
}
else if ( stage == CONTROL_STAGE_DATA )
{
// Handle class request only
TU_VERIFY(request->bmRequestType_bit.type == TUSB_REQ_TYPE_CLASS);
- if (tud_bt_hci_cmd_cb) tud_bt_hci_cmd_cb(&_btd_itf.hci_cmd, request->wLength);
+ if (tud_bt_hci_cmd_cb) tud_bt_hci_cmd_cb(&_btd_itf.hci_cmd, tu_min16(request->wLength, sizeof(_btd_itf.hci_cmd)));
}
return true;