Skip to contentSkip to conversation

gatt: Fail to register service with invalid Includes property

PATCH Applied Szymon Janc 2 participants 2 messages Mar 22, 2018 – Mar 23, 2018 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gatt: Fail to register service with invalid Includes property

This is optional property but if it is present it must be of proper type.

---
 src/gatt-database.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
src/gatt-database.c +4 -1
index a22fc3b85..19f03c544 100644
@@ -1676,6 +1676,7 @@ static bool parse_includes(GDBusProxy *proxy, struct external_service *service)
 	DBusMessageIter array;
 	char *obj;
 
+	/* Includes property is optional */
 	if (!g_dbus_proxy_get_property(proxy, "Includes", &iter))
 		return true;
 
@@ -2682,8 +2683,10 @@ static bool database_add_service(struct external_service *service)
 		return false;
 	}
 
-	if (!parse_includes(service->proxy, service))
+	if (!parse_includes(service->proxy, service)) {
 		error("Failed to read \"Includes\" property of service");
+		return false;
+	}
 
 	service->attrib = gatt_db_add_service(service->app->database->db, &uuid,
 						primary, service->attr_cnt);
Signature · 1 line
2.14.3
maintainer Applied
#1 lore raw

Hi Szymon,

Quoted 31 lines · Szymon Janc

This is optional property but if it is present it must be of proper type.

---
 src/gatt-database.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
src/gatt-database.c +4 -2
index a22fc3b85..19f03c544 100644
@@ -1676,6 +1676,7 @@ static bool parse_includes(GDBusProxy *proxy, struct external_service *service)
        DBusMessageIter array;
        char *obj;
 
+       /* Includes property is optional */
        if (!g_dbus_proxy_get_property(proxy, "Includes", &iter))
                return true;
 
@@ -2682,8 +2683,10 @@ static bool database_add_service(struct external_service *service)
                return false;
        }
 
-       if (!parse_includes(service->proxy, service))
+       if (!parse_includes(service->proxy, service)) {
                error("Failed to read \"Includes\" property of service");
+               return false;
+       }
 
        service->attrib = gatt_db_add_service(service->app->database->db, &uuid,
                                                primary, service->attr_cnt);
--
Quoted 1 line

2.14.3

Applied, thanks.

Signature · 1 line
Luiz Augusto von Dentz