Skip to content

Commit 1969ca3

Browse files
committed
host/l2cap: disconnect peer that sends L2CAP packets with hdr len > mtu
Rest of the checks disconnects peer if SDU size exceeds MTU, but value in header is OK. We should also disconnect if PDU lenght in L2CAP packet header exceeds it, regardles of how much data it actually contains, not just return error. This is affecting L2CAP/LE/CFC/BV-26-C and L2CAP/ECFC/BV-33-C
1 parent e744a88 commit 1969ca3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

nimble/host/src/ble_l2cap.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,8 +393,11 @@ ble_l2cap_rx(struct ble_hs_conn *conn,
393393
}
394394

395395
if (l2cap_hdr.len > ble_l2cap_get_mtu(chan)) {
396-
/* More data then we expected on the channel */
396+
/* More data than we expected on the channel.
397+
* Disconnect peer with invalid behaviour
398+
*/
397399
rc = BLE_HS_EBADDATA;
400+
ble_l2cap_disconnect(chan);
398401
goto err;
399402
}
400403

0 commit comments

Comments
 (0)