Prevent buffer overflow in bth_device.c#1090
Merged
Merged
Conversation
kasjer
reviewed
Sep 13, 2021
| 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)); |
Collaborator
There was a problem hiding this comment.
I would also consider adding similar size check in call to tud_bt_hci_cmd_cb() in line 224, as not to deceive BT stack about size of command buffer if wLength can not be trusted.
if (tud_bt_hci_cmd_cb) tud_bt_hci_cmd_cb(&_btd_itf.hci_cmd,
tu_min16(sizeof(_btd_itf.hci_cmd), request->wLength));
7FM
pushed a commit
to 7FM/tinyusb
that referenced
this pull request
Aug 23, 2025
* Add BSSID connection options to PicoW When working with a mesh or multiple APs with the same SSID, it is often necessary to specify which of the APs to connect to in order to maximize the WiFi strength. Add BSSID options to the SDK's PicoW cyw43_arch_wifi_connect_XXX APIs. Fixes hathach#1090 Co-authored-by: Earle F. Philhower, III <earlephilhower@yahoo.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Address possible buffer overflow in bth_device.c as described in issue #880 (btd_control_xfer_cb).
Passing size of _btd_itf.hci_cmd as len parameter to tud_control_xfer so that actual _ctrl_xfer.data_len will be set to minimum of buffer size and request wLength.