Skip to contentSkip to conversation

core/gatt-database: Fix endless loop

PATCH Applied Luiz Augusto von Dentz 1 participant 2 messages Apr 13, 2015 Bluetooth drivers

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/1 core/gatt-database: Fix endless loop

From: Luiz Augusto von Dentz <[email protected]>

The descriptors list may contain descriptors from another services which should be ignored but the code did not iterate to next item causing an endless loop if that happen.

---
 src/gatt-database.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
src/gatt-database.c +2 -1
index bbeb7cd..f182fd0 100644
@@ -1964,7 +1964,7 @@ static bool database_add_chrc(struct external_service *service,
 		struct external_desc *desc = entry->data;
 
 		if (desc->handled || g_strcmp0(desc->chrc_path, chrc->path))
-			continue;
+			goto next;
 
 		if (!database_add_desc(service, desc)) {
 			chrc->attrib = NULL;
@@ -1972,6 +1972,7 @@ static bool database_add_chrc(struct external_service *service,
 			return false;
 		}
 
+next:
 		entry = entry->next;
 	}
 
Signature · 1 line
2.1.0
author maintainer Applied
#1 lore raw

Hi,

Quoted 31 lines · Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

The descriptors list may contain descriptors from another services which should be ignored but the code did not iterate to next item causing an endless loop if that happen.

---
 src/gatt-database.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
src/gatt-database.c +2 -2
index bbeb7cd..f182fd0 100644
@@ -1964,7 +1964,7 @@ static bool database_add_chrc(struct external_service *service,
                struct external_desc *desc = entry->data;
 
                if (desc->handled || g_strcmp0(desc->chrc_path, chrc->path))
-                       continue;
+                       goto next;
 
                if (!database_add_desc(service, desc)) {
                        chrc->attrib = NULL;
@@ -1972,6 +1972,7 @@ static bool database_add_chrc(struct external_service *service,
                        return false;
                }
 
+next:
                entry = entry->next;
        }
 
--
Quoted 1 line

2.1.0

Applied.

Signature · 1 line
Luiz Augusto von Dentz