Skip to content

Commit bec18c3

Browse files
PavelVPVgithub-actions[bot]
authored andcommitted
bluetooth: mesh: pb_adv: check TotalLength against adv buf length
Check that the buffer length of the received advertising data is less than reported TotalLength in Transaction Start PDU. Signed-off-by: Pavel Vasilyev <[email protected]> (cherry picked from commit fe5b266)
1 parent 03db3db commit bec18c3

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

subsys/bluetooth/mesh/pb_adv.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,13 @@ static void gen_prov_start(struct prov_rx *rx, struct net_buf_simple *buf)
620620
return;
621621
}
622622

623+
if (link.rx.buf->len < buf->len) {
624+
LOG_ERR("Invalid declared provisionig PDU length (%u > %u)", buf->len,
625+
link.rx.buf->len);
626+
prov_failed(PROV_ERR_NVAL_FMT);
627+
return;
628+
}
629+
623630
if (START_LAST_SEG(rx->gpc) > 0 && link.rx.buf->len <= 20U) {
624631
LOG_ERR("Too small total length for multi-segment PDU");
625632
prov_failed(PROV_ERR_NVAL_FMT);

0 commit comments

Comments
 (0)