mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
bluetil: Ensure advertisement length does not exceed pkt len
This commit is contained in:
parent
61df141332
commit
84f1ae3635
@ -44,9 +44,13 @@ 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;
|
||||
}
|
||||
|
||||
if (ad->buf[pos + POS_TYPE] == type) {
|
||||
data->data = ad->buf + pos + POS_DATA;
|
||||
data->len = len - 1; /* take away the type field */
|
||||
|
Loading…
Reference in New Issue
Block a user