aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/dbus/dbus_new_introspect.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2015-01-06 13:55:51 (GMT)
committerJouni Malinen <j@w1.fi>2015-01-07 11:19:00 (GMT)
commitdacf6058129edab7f9c669bf4308342b3ed8905a (patch)
treee26050b07e07b195597fe78c9277305e6526563f /wpa_supplicant/dbus/dbus_new_introspect.c
parent68a866974b8ae279694ed626c9be678564e62b63 (diff)
downloadhostap-dacf6058129edab7f9c669bf4308342b3ed8905a.zip
hostap-dacf6058129edab7f9c669bf4308342b3ed8905a.tar.gz
hostap-dacf6058129edab7f9c669bf4308342b3ed8905a.tar.bz2
D-Bus: Fix Introspect() in case of os_strdup() failure
add_interface() did not check for os_strdup() return value and could end up dereferencing a NULL pointer if memory allocation failed. Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'wpa_supplicant/dbus/dbus_new_introspect.c')
-rw-r--r--wpa_supplicant/dbus/dbus_new_introspect.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/wpa_supplicant/dbus/dbus_new_introspect.c b/wpa_supplicant/dbus/dbus_new_introspect.c
index e0dd9e2..6209c67 100644
--- a/wpa_supplicant/dbus/dbus_new_introspect.c
+++ b/wpa_supplicant/dbus/dbus_new_introspect.c
@@ -37,14 +37,16 @@ static struct interfaces * add_interface(struct dl_list *list,
iface = os_zalloc(sizeof(struct interfaces));
if (!iface)
return NULL;
+ iface->dbus_interface = os_strdup(dbus_interface);
iface->xml = wpabuf_alloc(6000);
- if (iface->xml == NULL) {
+ if (iface->dbus_interface == NULL || iface->xml == NULL) {
+ os_free(iface->dbus_interface);
+ wpabuf_free(iface->xml);
os_free(iface);
return NULL;
}
wpabuf_printf(iface->xml, "<interface name=\"%s\">", dbus_interface);
dl_list_add_tail(list, &iface->list);
- iface->dbus_interface = os_strdup(dbus_interface);
return iface;
}