Skip to content

Commit

Permalink
bluetil: Ensure advertisement length does not exceed pkt len
Browse files Browse the repository at this point in the history
  • Loading branch information
Teufelchen1 committed Oct 1, 2024
1 parent 61df141 commit 4dcb162
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sys/net/ble/bluetil/bluetil_ad/bluetil_ad.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,12 @@ int bluetil_ad_find(const bluetil_ad_t *ad, uint8_t type,

unsigned pos = 0;

while ((pos + POS_TYPE) < ad->pos) {
while ((pos + POS_DATA) < ad->pos) {
uint8_t len = ad->buf[pos];

if (pos + len >= ad->pos)
return BLUETIL_AD_NOMEM;

Check warning on line 51 in sys/net/ble/bluetil/bluetil_ad/bluetil_ad.c

View workflow job for this annotation

GitHub Actions / static-tests

full block {} expected in the control structure

if (ad->buf[pos + POS_TYPE] == type) {
data->data = ad->buf + pos + POS_DATA;
data->len = len - 1; /* take away the type field */
Expand Down

0 comments on commit 4dcb162

Please sign in to comment.