Bluetooth: Fix Read Multiple Characteristics Values error response

According to Core Specification "An Error Response shall be sent by
the server in response to the Read Multiple Request if insufficient
authentication, insufficient authorization, insufficient encryption
key size is used by the client, or if a read operation is not permitted
on any of the Characteristic Values. The Error Code parameter is set as
specified in the Attribute Protocol."

If any handle used by client is invalid we should return and error.

Change-Id: I5489ce6284531822676a63edf13db23289866102
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
This commit is contained in:
Szymon Janc 2015-10-13 18:28:40 +02:00 committed by Anas Nashif
commit 3e3dbe2e23

View file

@ -785,6 +785,15 @@ static uint8_t att_read_mult_req(struct bt_conn *conn, struct bt_buf *buf)
BT_DBG("handle 0x%04x \n", handle); BT_DBG("handle 0x%04x \n", handle);
/* An Error Response shall be sent by the server in response to
* the Read Multiple Request [....] if a read operation is not
* permitted on any of the Characteristic Values.
*
* If handle is not valid then return invalid handle error.
* If handle is found error will be cleared by read_cb.
*/
data.err = BT_ATT_ERR_INVALID_HANDLE;
bt_gatt_foreach_attr(handle, handle, read_cb, &data); bt_gatt_foreach_attr(handle, handle, read_cb, &data);
/* Stop reading in case of error */ /* Stop reading in case of error */