1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #20881 from Teufelchen1/fix/rpble

bluetil: Ensure advertisement length does not exceed pkt len
This commit is contained in:
benpicco 2024-10-03 12:50:32 +00:00 committed by GitHub
commit 248371e11a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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 */