summaryrefslogtreecommitdiff
path: root/src/session.c
diff options
context:
space:
mode:
authorDaniel Wagner <daniel.wagner@bmw-carit.de>2012-10-31 10:33:35 +0100
committerPatrik Flykt <patrik.flykt@linux.intel.com>2012-11-05 14:47:43 +0200
commita3a100bf6b221dae3bf8144b3bfe7ed39740f357 (patch)
tree0a77866a5cd46815b8e423a165f21cedcf564740 /src/session.c
parent1dad942bf0cc29d0e0aa983239385841400dcf09 (diff)
downloadconnman-a3a100bf6b221dae3bf8144b3bfe7ed39740f357.tar.gz
connman-a3a100bf6b221dae3bf8144b3bfe7ed39740f357.tar.bz2
connman-a3a100bf6b221dae3bf8144b3bfe7ed39740f357.zip
session: parse_bearers() should check for invalid types
Diffstat (limited to 'src/session.c')
-rw-r--r--src/session.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/session.c b/src/session.c
index 85ce909b..caa29012 100644
--- a/src/session.c
+++ b/src/session.c
@@ -390,15 +390,22 @@ static int parse_bearers(DBusMessageIter *iter, GSList **list)
{
struct connman_session_bearer *bearer;
DBusMessageIter array;
- int err;
+ int type, err;
dbus_message_iter_recurse(iter, &array);
*list = NULL;
- while (dbus_message_iter_get_arg_type(&array) == DBUS_TYPE_STRING) {
+ while ((type = dbus_message_iter_get_arg_type(&array)) !=
+ DBUS_TYPE_INVALID) {
char *bearer_name = NULL;
+ if (type != DBUS_TYPE_STRING) {
+ connman_session_free_bearers(*list);
+ *list = NULL;
+ return -EINVAL;
+ }
+
dbus_message_iter_get_basic(&array, &bearer_name);
bearer = g_try_new0(struct connman_session_bearer, 1);