aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/dbus/dbus_old_handlers.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2014-06-13 22:29:42 (GMT)
committerJouni Malinen <j@w1.fi>2014-06-14 09:32:53 (GMT)
commit25be28a375d71693097e08e92d56085a158c73cf (patch)
tree6da9f98594f9871cc540665813346e97aa61d39c /wpa_supplicant/dbus/dbus_old_handlers.c
parentac79fcfa762490e4ce0610756dcd5418de9b1916 (diff)
downloadhostap-25be28a375d71693097e08e92d56085a158c73cf.zip
hostap-25be28a375d71693097e08e92d56085a158c73cf.tar.gz
hostap-25be28a375d71693097e08e92d56085a158c73cf.tar.bz2
dbus: Check return value more consistently (CID 62841)
Most of these calls are checked to return success and there is no reason why these wouldn't, so be more consistent. This addresses CID 62841, CID 62840, CID 62839, CID 62838, CID 62837, CID 62836. Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'wpa_supplicant/dbus/dbus_old_handlers.c')
-rw-r--r--wpa_supplicant/dbus/dbus_old_handlers.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/wpa_supplicant/dbus/dbus_old_handlers.c b/wpa_supplicant/dbus/dbus_old_handlers.c
index c0cb1c2..88e5254 100644
--- a/wpa_supplicant/dbus/dbus_old_handlers.c
+++ b/wpa_supplicant/dbus/dbus_old_handlers.c
@@ -350,7 +350,7 @@ DBusMessage * wpas_dbus_iface_scan(DBusMessage *message,
DBusMessage * wpas_dbus_iface_scan_results(DBusMessage *message,
struct wpa_supplicant *wpa_s)
{
- DBusMessage *reply = NULL;
+ DBusMessage *reply;
DBusMessageIter iter;
DBusMessageIter sub_iter;
struct wpa_bss *bss;
@@ -358,9 +358,10 @@ DBusMessage * wpas_dbus_iface_scan_results(DBusMessage *message,
/* Create and initialize the return message */
reply = dbus_message_new_method_return(message);
dbus_message_iter_init_append(reply, &iter);
- dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
- DBUS_TYPE_OBJECT_PATH_AS_STRING,
- &sub_iter);
+ if (!dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
+ DBUS_TYPE_OBJECT_PATH_AS_STRING,
+ &sub_iter))
+ goto error;
/* Loop through scan results and append each result's object path */
dl_list_for_each(bss, &wpa_s->bss_id, struct wpa_bss, list_id) {
@@ -374,13 +375,21 @@ DBusMessage * wpas_dbus_iface_scan_results(DBusMessage *message,
"%s/" WPAS_DBUS_BSSIDS_PART "/"
WPAS_DBUS_BSSID_FORMAT,
wpa_s->dbus_path, MAC2STR(bss->bssid));
- dbus_message_iter_append_basic(&sub_iter,
- DBUS_TYPE_OBJECT_PATH, &path);
+ if (!dbus_message_iter_append_basic(&sub_iter,
+ DBUS_TYPE_OBJECT_PATH,
+ &path))
+ goto error;
}
- dbus_message_iter_close_container(&iter, &sub_iter);
+ if (!dbus_message_iter_close_container(&iter, &sub_iter))
+ goto error;
return reply;
+
+error:
+ dbus_message_unref(reply);
+ return dbus_message_new_error(message, WPAS_ERROR_INTERNAL_ERROR,
+ "an internal error occurred returning scan results");
}