[glib: 5/8] gdbusdaemon: Fix error handling for filtering outgoing messages
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 5/8] gdbusdaemon: Fix error handling for filtering outgoing messages
- Date: Mon, 15 Apr 2019 09:11:57 +0000 (UTC)
commit 96aa2e34b3a1c5aa91549a0568d4043b1b69c4af
Author: Philip Withnall <withnall endlessm com>
Date: Fri Apr 12 16:55:17 2019 +0100
gdbusdaemon: Fix error handling for filtering outgoing messages
If the filter function for an outgoing message fails to copy the
GDBusMessage, that failure was previously ignored, and GDBusMessage
methods could be called on a NULL instance.
Avoid that.
Signed-off-by: Philip Withnall <withnall endlessm com>
gio/gdbusdaemon.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
---
diff --git a/gio/gdbusdaemon.c b/gio/gdbusdaemon.c
index e6b3c1af0..a9b626215 100644
--- a/gio/gdbusdaemon.c
+++ b/gio/gdbusdaemon.c
@@ -1493,16 +1493,21 @@ filter_function (GDBusConnection *connection,
}
else
{
+ if (g_dbus_message_get_sender (message) == NULL ||
+ g_dbus_message_get_destination (message) == NULL)
+ {
+ message = copy_if_locked (message);
+ if (message == NULL)
+ {
+ g_warning ("Failed to copy outgoing message");
+ return NULL;
+ }
+ }
+
if (g_dbus_message_get_sender (message) == NULL)
- {
- message = copy_if_locked (message);
- g_dbus_message_set_sender (message, DBUS_SERVICE_NAME);
- }
+ g_dbus_message_set_sender (message, DBUS_SERVICE_NAME);
if (g_dbus_message_get_destination (message) == NULL)
- {
- message = copy_if_locked (message);
- g_dbus_message_set_destination (message, client->id);
- }
+ g_dbus_message_set_destination (message, client->id);
}
return message;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]