summaryrefslogtreecommitdiff
path: root/attrib
diff options
context:
space:
mode:
authorDirk-Jan C. Binnema <djcb@djcbsoftware.nl>2013-07-29 11:42:48 -0700
committerJohan Hedberg <johan.hedberg@intel.com>2013-07-30 12:59:12 +0300
commitf3e175bd7884c7c84b68b7167d5e4dc805d374c5 (patch)
treed43d23608ebfb6ea8cb17363149e093c3a6a8251 /attrib
parentaf6855c6c25e15e647c91a8298c279b4a7457303 (diff)
downloadbluez-f3e175bd7884c7c84b68b7167d5e4dc805d374c5.tar.gz
attrib: Update gatt_service_add size assert for dealing with 128-bit UUIDs
To paraphrase Anderson Lizardo: "h" was overflowing for 128-bit services because the handle is incremented after each attribute is added so at the end we had: 0xffff + 1 == 0 (h is uint16_t). As it seems more complex to try to remove the overflow without affecting the logic too much, we update the assertion.
Diffstat (limited to 'attrib')
-rw-r--r--attrib/gatt-service.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/attrib/gatt-service.c b/attrib/gatt-service.c
index 4b02d39e4..1b84c893b 100644
--- a/attrib/gatt-service.c
+++ b/attrib/gatt-service.c
@@ -341,7 +341,7 @@ gboolean gatt_service_add(struct btd_adapter *adapter, uint16_t uuid,
}
g_assert(size < USHRT_MAX);
- g_assert(h - start_handle == (uint16_t) size);
+ g_assert(h == 0 || (h - start_handle == (uint16_t) size));
g_slist_free_full(chrs, free_gatt_info);
return TRUE;