Skip to content

Commit fe5b266

Browse files
PavelVPVcfriedt
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 <pavel.vasilyev@nordicsemi.no>
1 parent 0d68cc3 commit fe5b266

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
@@ -634,6 +634,13 @@ static void gen_prov_start(struct prov_rx *rx, struct net_buf_simple *buf)
634634
return;
635635
}
636636

637+
if (link.rx.buf->len < buf->len) {
638+
LOG_ERR("Invalid declared provisionig PDU length (%u > %u)", buf->len,
639+
link.rx.buf->len);
640+
prov_failed(PROV_ERR_NVAL_FMT);
641+
return;
642+
}
643+
637644
if (START_LAST_SEG(rx->gpc) > 0 && link.rx.buf->len <= 20U) {
638645
LOG_ERR("Too small total length for multi-segment PDU");
639646
prov_failed(PROV_ERR_NVAL_FMT);

0 commit comments

Comments
 (0)