From a4990946d6ae42a4f66439acca63668c61690990 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sun, 4 Mar 2012 20:34:19 -0800 Subject: [PATCH] core: Add extra checks for set property methods --- src/clock.c | 7 +++++++ src/manager.c | 7 +++++++ src/service.c | 7 +++++++ src/technology.c | 7 +++++++ 4 files changed, 28 insertions(+) diff --git a/src/clock.c b/src/clock.c index 0d7f870..c3644ea 100644 --- a/src/clock.c +++ b/src/clock.c @@ -169,8 +169,15 @@ static DBusMessage *set_property(DBusConnection *conn, if (dbus_message_iter_init(msg, &iter) == FALSE) return __connman_error_invalid_arguments(msg); + if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING) + return __connman_error_invalid_arguments(msg); + dbus_message_iter_get_basic(&iter, &name); dbus_message_iter_next(&iter); + + if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_VARIANT) + return __connman_error_invalid_arguments(msg); + dbus_message_iter_recurse(&iter, &value); type = dbus_message_iter_get_arg_type(&value); diff --git a/src/manager.c b/src/manager.c index c07e187..e475d32 100644 --- a/src/manager.c +++ b/src/manager.c @@ -85,8 +85,15 @@ static DBusMessage *set_property(DBusConnection *conn, if (dbus_message_iter_init(msg, &iter) == FALSE) return __connman_error_invalid_arguments(msg); + if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING) + return __connman_error_invalid_arguments(msg); + dbus_message_iter_get_basic(&iter, &name); dbus_message_iter_next(&iter); + + if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_VARIANT) + return __connman_error_invalid_arguments(msg); + dbus_message_iter_recurse(&iter, &value); type = dbus_message_iter_get_arg_type(&value); diff --git a/src/service.c b/src/service.c index 410a8da..d301b2f 100644 --- a/src/service.c +++ b/src/service.c @@ -2623,8 +2623,15 @@ static DBusMessage *set_property(DBusConnection *conn, if (dbus_message_iter_init(msg, &iter) == FALSE) return __connman_error_invalid_arguments(msg); + if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING) + return __connman_error_invalid_arguments(msg); + dbus_message_iter_get_basic(&iter, &name); dbus_message_iter_next(&iter); + + if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_VARIANT) + return __connman_error_invalid_arguments(msg); + dbus_message_iter_recurse(&iter, &value); type = dbus_message_iter_get_arg_type(&value); diff --git a/src/technology.c b/src/technology.c index 91308a1..2b34f50 100644 --- a/src/technology.c +++ b/src/technology.c @@ -683,8 +683,15 @@ static DBusMessage *set_property(DBusConnection *conn, if (dbus_message_iter_init(msg, &iter) == FALSE) return __connman_error_invalid_arguments(msg); + if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING) + return __connman_error_invalid_arguments(msg); + dbus_message_iter_get_basic(&iter, &name); dbus_message_iter_next(&iter); + + if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_VARIANT) + return __connman_error_invalid_arguments(msg); + dbus_message_iter_recurse(&iter, &value); type = dbus_message_iter_get_arg_type(&value); -- 2.7.4