teknoraver / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone

Blame 0001-dbus-common-fix-segfault-when-a-DBus-message-has-no-.patch

Lennart Poettering 7e98ac
From cda2b84a69905aafe2f8c6bd3f1c9eefe92b6bbb Mon Sep 17 00:00:00 2001
Lennart Poettering 7e98ac
From: Michal Schmidt <mschmidt@redhat.com>
Lennart Poettering 7e98ac
Date: Wed, 25 May 2011 16:17:17 +0200
Lennart Poettering 7e98ac
Subject: [PATCH] dbus-common: fix segfault when a DBus message has no
Lennart Poettering 7e98ac
 interface
Lennart Poettering 7e98ac
Lennart Poettering 7e98ac
dbus_message_get_interface() may return NULL.
Lennart Poettering 7e98ac
Lennart Poettering 7e98ac
https://bugzilla.redhat.com/show_bug.cgi?id=707483
Lennart Poettering 7e98ac
---
Lennart Poettering 7e98ac
 src/dbus-common.c |   10 +++++++---
Lennart Poettering 7e98ac
 1 files changed, 7 insertions(+), 3 deletions(-)
Lennart Poettering 7e98ac
Lennart Poettering 7e98ac
diff --git a/src/dbus-common.c b/src/dbus-common.c
Lennart Poettering 7e98ac
index 9bf0dab..5db077b 100644
Lennart Poettering 7e98ac
--- a/src/dbus-common.c
Lennart Poettering 7e98ac
+++ b/src/dbus-common.c
Lennart Poettering 7e98ac
@@ -418,9 +418,13 @@ DBusHandlerResult bus_default_message_handler(
Lennart Poettering 7e98ac
                         return bus_send_error_reply(c, message, &error, -EINVAL);
Lennart Poettering 7e98ac
                 }
Lennart Poettering 7e98ac
 
Lennart Poettering 7e98ac
-        } else if (!nulstr_contains(interfaces, dbus_message_get_interface(message))) {
Lennart Poettering 7e98ac
-                dbus_set_error_const(&error, DBUS_ERROR_UNKNOWN_INTERFACE, "Unknown interface");
Lennart Poettering 7e98ac
-                return bus_send_error_reply(c, message, &error, -EINVAL);
Lennart Poettering 7e98ac
+        } else {
Lennart Poettering 7e98ac
+                const char *interface = dbus_message_get_interface(message);
Lennart Poettering 7e98ac
+
Lennart Poettering 7e98ac
+                if (!interface || !nulstr_contains(interfaces, interface)) {
Lennart Poettering 7e98ac
+                        dbus_set_error_const(&error, DBUS_ERROR_UNKNOWN_INTERFACE, "Unknown interface");
Lennart Poettering 7e98ac
+                        return bus_send_error_reply(c, message, &error, -EINVAL);
Lennart Poettering 7e98ac
+                }
Lennart Poettering 7e98ac
         }
Lennart Poettering 7e98ac
 
Lennart Poettering 7e98ac
         if (reply) {
Lennart Poettering 7e98ac
-- 
Lennart Poettering 7e98ac
1.7.5.2
Lennart Poettering 7e98ac