mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-29 13:20:39 +00:00
L2CAP: validate packet size with remote MTU -> log_error
This commit is contained in:
parent
aeb32d01e7
commit
f0efaa575f
@ -473,6 +473,7 @@ extern "C" {
|
||||
#define L2CAP_CONNECTION_RESPONSE_RESULT_RTX_TIMEOUT 0x68
|
||||
|
||||
#define L2CAP_SERVICE_ALREADY_REGISTERED 0x69
|
||||
#define L2CAP_DATA_LEN_EXCEEDS_REMOTE_MTU 0x6A
|
||||
|
||||
#define RFCOMM_MULTIPLEXER_STOPPED 0x70
|
||||
#define RFCOMM_CHANNEL_ALREADY_REGISTERED 0x71
|
||||
|
@ -464,6 +464,11 @@ int l2cap_send_internal(uint16_t local_cid, uint8_t *data, uint16_t len){
|
||||
return -1; // TODO: define error
|
||||
}
|
||||
|
||||
if (len > channel->remote_mtu){
|
||||
log_error("l2cap_send_internal cid 0x%02x, data length exceeds remote MTU.", local_cid);
|
||||
return L2CAP_DATA_LEN_EXCEEDS_REMOTE_MTU;
|
||||
}
|
||||
|
||||
if (!hci_can_send_acl_packet_now(channel->handle)){
|
||||
log_info("l2cap_send_internal cid 0x%02x, cannot send", local_cid);
|
||||
return BTSTACK_ACL_BUFFERS_FULL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user