diff options
author | Richard Hughes <richard@hughsie.com> | 2010-11-01 09:52:07 +0000 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2010-11-01 09:52:07 +0000 |
commit | ed34986e08fc45e5337c3edae181c3caa23c99d2 (patch) | |
tree | a3ae4408569176533a39011c477ca0527142ec67 | |
parent | 7176815926fa5c1eba4c4a4a375dc8115cc3915f (diff) |
libupower-glib: Reject invalid object paths to avoid asserting libdbus
-rw-r--r-- | libupower-glib/up-device.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libupower-glib/up-device.c b/libupower-glib/up-device.c index 999f25b..918f51a 100644 --- a/libupower-glib/up-device.c +++ b/libupower-glib/up-device.c @@ -286,6 +286,12 @@ up_device_set_object_path_sync (UpDevice *device, const gchar *object_path, GCan if (object_path == NULL) return FALSE; + /* invalid */ + if (object_path == NULL || object_path[0] != '/') { + g_set_error (error, 1, 0, "Object path %s invalid", object_path); + goto out; + } + /* connect to the bus */ device->priv->bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error_local); if (device->priv->bus == NULL) { |