Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions subsys/bluetooth/host/shell/bt.c
Original file line number Diff line number Diff line change
Expand Up @@ -5176,13 +5176,13 @@ int ead_update_ad(void)
while (idx < bt_shell_ead_data_size && ad_structs_idx < BT_SHELL_EAD_MAX_AD) {
ad = &ad_structs[ad_structs_idx];

/* the data_len from bt_data struct doesn't include the size of the type */
ad->data_len = bt_shell_ead_data[idx] - 1;

if (ad->data_len < 0) {
/* if the len is less than 0 that mean there is not even a type field */
bt_shell_error("Failed to update AD due to malformed AD.");
return -ENOEXEC;
/* bt_shell_ead_data[idx] includes the AD type byte. */
if (bt_shell_ead_data[idx] > 0) {
ad->data_len = bt_shell_ead_data[idx] - 1;
} else {
/* Zero length means the AD field does not even contain a type */
bt_shell_error("Failed to update AD due to malformed AD.");
return -ENOEXEC;
}

ad->type = bt_shell_ead_data[idx + 1];
Expand Down