summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2011-05-25 16:17:17 +0200
committerLennart Poettering <lennart@poettering.net>2011-05-25 18:07:31 +0200
commitcda2b84a69905aafe2f8c6bd3f1c9eefe92b6bbb (patch)
treebb60dc6e46b7784a713d9b5c6d27b59af296ee1e /src
parentd636fa3d67a76e512c5a3b2028e2c62ec5bbc50c (diff)
dbus-common: fix segfault when a DBus message has no interface
dbus_message_get_interface() may return NULL. https://bugzilla.redhat.com/show_bug.cgi?id=707483
Diffstat (limited to 'src')
-rw-r--r--src/dbus-common.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/dbus-common.c b/src/dbus-common.c
index 9bf0dabe4c..5db077b74f 100644
--- a/src/dbus-common.c
+++ b/src/dbus-common.c
@@ -418,9 +418,13 @@ DBusHandlerResult bus_default_message_handler(
return bus_send_error_reply(c, message, &error, -EINVAL);
}
- } else if (!nulstr_contains(interfaces, dbus_message_get_interface(message))) {
- dbus_set_error_const(&error, DBUS_ERROR_UNKNOWN_INTERFACE, "Unknown interface");
- return bus_send_error_reply(c, message, &error, -EINVAL);
+ } else {
+ const char *interface = dbus_message_get_interface(message);
+
+ if (!interface || !nulstr_contains(interfaces, interface)) {
+ dbus_set_error_const(&error, DBUS_ERROR_UNKNOWN_INTERFACE, "Unknown interface");
+ return bus_send_error_reply(c, message, &error, -EINVAL);
+ }
}
if (reply) {