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:
Arkadiusz Lichwa 2015-09-23 15:54:45 +02:00 committed by Anas Nashif
commit c52cae5366

View file

@ -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