diff options
author | Ted Gould <ted@gould.cx> | 2013-09-09 23:33:20 +0000 |
---|---|---|
committer | Tarmac <Unknown> | 2013-09-09 23:33:20 +0000 |
commit | ec30f371ac5a8b184a3ab2f8e3265f1fdb5efdc9 (patch) | |
tree | bc3fcbfa481b1ab6cf9d9975e9c62daca8266504 | |
parent | 9ee26dd8ba9c0f57a114f4e3fa8f292bf37fc4d4 (diff) | |
parent | 99cf6a9d90ce9cf3b53899fabddf9a2584ececeb (diff) | |
download | libdbusmenu-ec30f371ac5a8b184a3ab2f8e3265f1fdb5efdc9.tar.gz libdbusmenu-ec30f371ac5a8b184a3ab2f8e3265f1fdb5efdc9.tar.bz2 libdbusmenu-ec30f371ac5a8b184a3ab2f8e3265f1fdb5efdc9.zip |
Protect client_new functions from bad dbus names and objects.
Approved by PS Jenkins bot, Charles Kerr.
-rw-r--r-- | libdbusmenu-glib/client.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 4bb3217..800c96c 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -560,12 +560,16 @@ set_property (GObject * obj, guint id, const GValue * value, GParamSpec * pspec) switch (id) { case PROP_DBUSNAME: + g_return_if_fail(g_dbus_is_name(g_value_get_string(value))); + priv->dbus_name = g_value_dup_string(value); if (priv->dbus_name != NULL && priv->dbus_object != NULL) { build_proxies(DBUSMENU_CLIENT(obj)); } break; case PROP_DBUSOBJECT: + g_return_if_fail(g_variant_is_object_path(g_value_get_string(value))); + priv->dbus_object = g_value_dup_string(value); if (priv->dbus_name != NULL && priv->dbus_object != NULL) { build_proxies(DBUSMENU_CLIENT(obj)); @@ -2472,6 +2476,9 @@ update_layout (DbusmenuClient * client) DbusmenuClient * dbusmenu_client_new (const gchar * name, const gchar * object) { + g_return_val_if_fail(g_dbus_is_name(name), NULL); + g_return_val_if_fail(g_variant_is_object_path(object), NULL); + DbusmenuClient * self = g_object_new(DBUSMENU_TYPE_CLIENT, DBUSMENU_CLIENT_PROP_DBUS_NAME, name, DBUSMENU_CLIENT_PROP_DBUS_OBJECT, object, |