Skip to content

Commit

Permalink
Merge pull request #2081 from Scepticz/patch-1
Browse files Browse the repository at this point in the history
Fix l2cap_channels OOB in get_channel_for_cid
  • Loading branch information
nfi committed Jul 21, 2022
2 parents cae20d7 + f28ca56 commit 3216ebf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions os/net/mac/ble/ble-l2cap.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ get_channel_for_addr(const linkaddr_t *peer_addr)
static l2cap_channel_t *
get_channel_for_cid(uint16_t own_cid)
{
uint8_t i = own_cid - L2CAP_FLOW_CHANNEL;
int16_t i = own_cid - L2CAP_FLOW_CHANNEL;
if(i >= 0 && i < l2cap_channel_count) {
return &l2cap_channels[own_cid - L2CAP_FLOW_CHANNEL];
return &l2cap_channels[i];
} else {
return NULL;
}
Expand Down

0 comments on commit 3216ebf

Please sign in to comment.