Bluetooth: Mesh: check buffer tailroom before relaying proxy message
PR adds checking proxy buffer tailroom before adding a relayed message. That prevents potential proxy trash attacks. Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
This commit is contained in:
parent
fc49ad3ac6
commit
4b5be77531
1 changed files with 5 additions and 0 deletions
|
@ -78,6 +78,11 @@ ssize_t bt_mesh_proxy_msg_recv(struct bt_conn *conn,
|
|||
const uint8_t *data = buf;
|
||||
struct bt_mesh_proxy_role *role = &roles[bt_conn_index(conn)];
|
||||
|
||||
if (net_buf_simple_tailroom(&role->buf) < len - 1) {
|
||||
LOG_WRN("Proxy role buffer overflow");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
switch (PDU_SAR(data)) {
|
||||
case SAR_COMPLETE:
|
||||
if (role->buf.len) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue