From f694885825950278afaf92dd36ab6f7c89085983 Mon Sep 17 00:00:00 2001 From: Anderson Lizardo Date: Wed, 16 Mar 2011 16:30:16 -0400 Subject: [PATCH] Check for existing handle in attrib_db_add() This check is necessary to avoid inserting attributes with same handle. --- src/attrib-server.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/attrib-server.c b/src/attrib-server.c index 597a63583..74a1c8d80 100644 --- a/src/attrib-server.c +++ b/src/attrib-server.c @@ -1213,10 +1213,12 @@ struct attribute *attrib_db_add(uint16_t handle, bt_uuid_t *uuid, int read_reqs, int write_reqs, const uint8_t *value, int len) { struct attribute *a; + guint h = handle; DBG("handle=0x%04x", handle); - /* FIXME: handle conflicts */ + if (g_slist_find_custom(database, GUINT_TO_POINTER(h), handle_cmp)) + return NULL; a = g_malloc0(sizeof(struct attribute) + len); a->handle = handle; -- 2.47.3