bluetooth: host: Fix endianness issue for group end_handle.

Convert end_handle to native endianness before comparison.

Signed-off-by: Wolfgang Puffitsch <wopu@oticon.com>
This commit is contained in:
Wolfgang Puffitsch 2019-02-07 10:00:53 +01:00 committed by Johan Hedberg
commit aed74024b5

View file

@ -537,7 +537,8 @@ static u8_t find_type_cb(const struct bt_gatt_attr *attr, void *user_data)
/* Update group end_handle if not a primary service */
if (bt_uuid_cmp(attr->uuid, BT_UUID_GATT_PRIMARY)) {
if (data->group && attr->handle > data->group->end_handle) {
if (data->group &&
attr->handle > sys_le16_to_cpu(data->group->end_handle)) {
data->group->end_handle = sys_cpu_to_le16(attr->handle);
}
return BT_GATT_ITER_CONTINUE;
@ -1047,7 +1048,8 @@ static u8_t read_group_cb(const struct bt_gatt_attr *attr, void *user_data)
/* Update group end_handle if attribute is not a service */
if (bt_uuid_cmp(attr->uuid, BT_UUID_GATT_PRIMARY) &&
bt_uuid_cmp(attr->uuid, BT_UUID_GATT_SECONDARY)) {
if (data->group && attr->handle > data->group->end_handle) {
if (data->group &&
attr->handle > sys_le16_to_cpu(data->group->end_handle)) {
data->group->end_handle = sys_cpu_to_le16(attr->handle);
}
return BT_GATT_ITER_CONTINUE;