From ed34986e08fc45e5337c3edae181c3caa23c99d2 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Mon, 1 Nov 2010 09:52:07 +0000 Subject: [PATCH] libupower-glib: Reject invalid object paths to avoid asserting libdbus --- libupower-glib/up-device.c | 6 ++++++ 1 file changed, 6 insertions(+) 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) {