aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTodd Previte <toddx.a.previte@intel.com>2012-02-04 11:13:59 (GMT)
committerJouni Malinen <j@w1.fi>2012-02-04 11:13:59 (GMT)
commit4bb70bd80d61a451b598102bd26f5348846fdef0 (patch)
tree8abe082e1429bdd20185e3b6af9d6c0475d37fa1
parentaa89df56996c0da499f1cdb132893c1863b6b2fb (diff)
downloadhostap-4bb70bd80d61a451b598102bd26f5348846fdef0.zip
hostap-4bb70bd80d61a451b598102bd26f5348846fdef0.tar.gz
hostap-4bb70bd80d61a451b598102bd26f5348846fdef0.tar.bz2
P2P: Fix the setter function for DBus group properties
The setter function uses the same hostapd_data structure as the getter which causes it to crash if called on a P2P client. To overcome this issue, the role is checked to ensure it is called on a group owner and the pointer is examined for validity. The function will return an error if called on a non-GO system. Signed-hostap: Todd Previte <toddx.a.previte@intel.com> Signed-hostap: Angie Chinchilla <angie.v.chinchilla@intel.com> intended-for: hostap-1
-rw-r--r--wpa_supplicant/dbus/dbus_new_handlers_p2p.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
index 2476e62..bc63d47 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
+++ b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
@@ -1770,13 +1770,13 @@ dbus_bool_t wpas_dbus_setter_p2p_group_properties(DBusMessageIter *iter,
DBusMessageIter variant_iter, iter_dict;
struct wpa_dbus_dict_entry entry = { .type = DBUS_TYPE_STRING };
unsigned int i;
- struct hostapd_data *hapd = wpa_s->ap_iface->bss[0];
+ struct hostapd_data *hapd = NULL;
- if (!hapd) {
- dbus_set_error_const(error, DBUS_ERROR_FAILED,
- "internal error");
+ if (wpas_get_p2p_role(wpa_s) == WPAS_P2P_ROLE_GO &&
+ wpa_s->ap_iface != NULL)
+ hapd = wpa_s->ap_iface->bss[0];
+ else
return FALSE;
- }
dbus_message_iter_recurse(iter, &variant_iter);
if (!wpa_dbus_dict_open_read(&variant_iter, &iter_dict, error))