This fixes a crash that was introduced in commit
6f6927236fc35429eecb1b1459ea5e20ab667db8. It is possible for the role
to be NULL, which caused a crash in strcmp.
---
 plugins/bluetooth.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/plugins/bluetooth.c b/plugins/bluetooth.c
index 76669c8..7df8b24 100644
--- a/plugins/bluetooth.c
+++ b/plugins/bluetooth.c
@@ -393,7 +393,8 @@ static void btdevice_property_change(GDBusProxy *proxy, 
const char *name,
                DBusMessageIter *iter, void *user_data)
 {
        struct bluetooth_pan *pan;
-       const char* pan_role = NULL;
+       const char *old_role = NULL;
+       const char *new_role;
 
        if (strcmp(name, "UUIDs"))
                return;
@@ -404,12 +405,13 @@ static void btdevice_property_change(GDBusProxy *proxy, 
const char *name,
 
        if (pan->network &&
                        connman_network_get_device(pan->network))
-               pan_role = pan->pan_role;
+               old_role = pan->pan_role;
+       new_role = proxy_get_role(pan->btdevice_proxy)
 
-       DBG("network %p network role %s proxy role %s", pan->network, pan_role,
-                       proxy_get_role(pan->btdevice_proxy));
+       DBG("network %p network role %s proxy role %s", pan->network, old_role,
+                       new_role);
 
-       if (!strcmp(proxy_get_role(pan->btdevice_proxy), pan_role))
+       if (old_role && new_role && !strcmp(old_role, new_role))
                return;
 
        pan_create_nap(pan);
-- 
1.9.1

_______________________________________________
connman mailing list
[email protected]
https://lists.connman.net/mailman/listinfo/connman

Reply via email to