Skip to content

Commit 799c804

Browse files
committed
Bluetooth: Mesh: Transport length checks should account for MIC
The Transport layer would previously rely on the access layer to check whether there's room for the full message and a MIC in the available buffer space, and its own checks would ignore the MIC. This should be handled by the Transport layer checks, so the access layer doesn't have to. Signed-off-by: Trond Einar Snekvik <[email protected]>
1 parent a8ef1ee commit 799c804

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

subsys/bluetooth/mesh/transport.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -632,12 +632,12 @@ int bt_mesh_trans_send(struct bt_mesh_net_tx *tx, struct net_buf_simple *msg,
632632
return -EINVAL;
633633
}
634634

635-
if (msg->len > BT_MESH_TX_SDU_MAX) {
636-
BT_ERR("Not enough segment buffers for length %u", msg->len);
635+
if (msg->len > BT_MESH_TX_SDU_MAX - BT_MESH_MIC_SHORT) {
636+
BT_ERR("Message too big: %u", msg->len);
637637
return -EMSGSIZE;
638638
}
639639

640-
if (net_buf_simple_tailroom(msg) < 4) {
640+
if (net_buf_simple_tailroom(msg) < BT_MESH_MIC_SHORT) {
641641
BT_ERR("Insufficient tailroom for Transport MIC");
642642
return -EINVAL;
643643
}

0 commit comments

Comments
 (0)