Bluetoth: controller: Fix memory corruption in RPA refresh

memcpy() could overwrite memory adjacent to "pdu" due to invalid
copy size.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
This commit is contained in:
Andrzej Kaczmarek 2020-12-07 12:50:20 +01:00 committed by Carles Cufí
parent 392e044548
commit f0352500b3

View file

@ -974,7 +974,7 @@ static void rpa_adv_refresh(struct ll_adv_set *adv)
prev = lll_adv_data_peek(&adv->lll);
pdu = lll_adv_data_alloc(&adv->lll, &idx);
memcpy(pdu, prev, PDU_AC_LL_HEADER_SIZE + pdu->len);
memcpy(pdu, prev, PDU_AC_LL_HEADER_SIZE + prev->len);
ull_adv_pdu_update_addrs(adv, pdu);
lll_adv_data_enqueue(&adv->lll, idx);