Skip to content

Instantly share code, notes, and snippets.

@R0rt1z2
Created May 7, 2024 21:25
Show Gist options
  • Save R0rt1z2/54cc537f89605e27904c83a84f22a820 to your computer and use it in GitHub Desktop.
Save R0rt1z2/54cc537f89605e27904c83a84f22a820 to your computer and use it in GitHub Desktop.
diff --git a/device/src/controller.cc b/device/src/controller.cc
index ce19f5c..2d9815a 100644
--- a/device/src/controller.cc
+++ b/device/src/controller.cc
@@ -196,8 +196,10 @@ static future_t* start_up(void) {
}
#endif
- ble_supported = last_features_classic_page_index >= 1 &&
- HCI_LE_HOST_SUPPORTED(features_classic[1].as_array);
+ if (last_features_classic_page_index < 1)
+ last_features_classic_page_index = 1;
+
+ ble_supported = true;
if (ble_supported) {
// Request the ble white list size next
response = AWAIT_COMMAND(packet_factory->make_ble_read_white_list_size());
diff --git a/hci/src/hci_packet_parser.cc b/hci/src/hci_packet_parser.cc
index b1efd44..0e231a5 100644
--- a/hci/src/hci_packet_parser.cc
+++ b/hci/src/hci_packet_parser.cc
@@ -114,12 +114,12 @@ static void parse_read_local_extended_features_response(
uint8_t* stream = read_command_complete_header(
response, HCI_READ_LOCAL_EXT_FEATURES,
2 + sizeof(bt_device_features_t) /* bytes after */);
- CHECK(stream != NULL);
+ if (stream == NULL) return;
STREAM_TO_UINT8(*page_number_ptr, stream);
STREAM_TO_UINT8(*max_page_number_ptr, stream);
- CHECK(*page_number_ptr < feature_pages_count);
+ if (*page_number_ptr >= feature_pages_count) return;
STREAM_TO_ARRAY(feature_pages[*page_number_ptr].as_array, stream,
(int)sizeof(bt_device_features_t));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment