Bluetooth: GATT: Fix differentiate errors on write ccc
Refines errors check when attempting to write over the boundary of attribute room. Change-Id: Ia27b86ce380a178b8e7834adf6da4009a6d60233 Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
This commit is contained in:
parent
5438f7b96b
commit
c52cae5366
1 changed files with 5 additions and 1 deletions
|
@ -246,10 +246,14 @@ int bt_gatt_attr_write_ccc(struct bt_conn *conn,
|
||||||
bool bonded;
|
bool bonded;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
if (len != sizeof(*data) || offset) {
|
if (offset > sizeof(*data)) {
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (offset + len > sizeof(*data)) {
|
||||||
|
return -EFBIG;
|
||||||
|
}
|
||||||
|
|
||||||
if (bt_keys_find_addr(&conn->dst))
|
if (bt_keys_find_addr(&conn->dst))
|
||||||
bonded = true;
|
bonded = true;
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue