diff --git a/src/mgmt.c b/src/mgmt.c
index 2bf8b9d..3bf45ef 100644
--- a/src/mgmt.c
+++ b/src/mgmt.c
memcpy(uuid128, uuid, sizeof(*uuid));
}
+static bool is_16bit_uuid(const uuid_t *uuid)
+{
+ uuid_t tmp;
+
+ uuid_to_uuid128(&tmp, uuid);
+
+ if (!sdp_uuid128_to_uuid(&tmp))
+ return false;
+
+ if (tmp.type != SDP_UUID16)
+ return false;
+
+ return true;
+}
+
int mgmt_add_uuid(int index, uuid_t *uuid, uint8_t svc_hint)
{
char buf[MGMT_HDR_SIZE + sizeof(struct mgmt_cp_add_uuid)];
DBG("index %d", index);
+ if (!is_16bit_uuid(uuid)) {
+ warn("mgmt_add_uuid: Ignoring non-16-bit UUID");
+ return 0;
+ }
+
if (info->pending_uuid) {
struct pending_uuid *pending = g_new0(struct pending_uuid, 1);
DBG("index %d", index);
+ if (!is_16bit_uuid(uuid)) {
+ warn("mgmt_remove_uuid: Ignoring non-16-bit UUID");
+ return 0;
+ }
+
if (info->pending_uuid) {
struct pending_uuid *pending = g_new0(struct pending_uuid, 1);