diff options
author | David Lechner <david@lechnology.com> | 2014-11-03 23:24:40 -0600 |
---|---|---|
committer | Patrik Flykt <patrik.flykt@linux.intel.com> | 2014-11-10 15:27:56 +0200 |
commit | ad5b8ddd5e2be8f150d468e4ec557c4aab112fe5 (patch) | |
tree | b9d6421eaf1c112210521d314f32665ab41c8cb3 /plugins/bluetooth.c | |
parent | b425fd8c8e85e9ee0d2cd05abe792a0ab85ce660 (diff) | |
download | connman-ad5b8ddd5e2be8f150d468e4ec557c4aab112fe5.tar.gz |
Fix crash when role is NULL.
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.
Diffstat (limited to 'plugins/bluetooth.c')
-rw-r--r-- | plugins/bluetooth.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/plugins/bluetooth.c b/plugins/bluetooth.c index 76669c8a..c6f387ed 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); |