File gdm-fix-crash-when-using-Xvfb.patch of Package gdm.38857
From b7bbd224b0aef9d6c75c876153fdf778b5346fd9 Mon Sep 17 00:00:00 2001
From: Benjamin Berg <bberg@redhat.com>
Date: Fri, 21 Aug 2020 12:14:32 +0200
Subject: [PATCH 1/2] manager: Fix possible crash by initializing display
Some people insist on running sessions in ways where we cannot detect
them properly. In that case, we shouldn't find a display, but the
variable was not initialized and we could end up accessing random memory
resulting in a crash.
Fix it by adding the missing initializer.
Closes: #555
---
daemon/gdm-manager.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c
index 907eca37..e1bc09b1 100644
--- a/daemon/gdm-manager.c
+++ b/daemon/gdm-manager.c
@@ -811,7 +811,7 @@ gdm_manager_handle_register_session (GdmDBusManager *manager,
GVariant *details)
{
GdmManager *self = GDM_MANAGER (manager);
- GdmDisplay *display;
+ GdmDisplay *display = NULL;
const char *sender;
GDBusConnection *connection;
--
2.30.0
From 84b4f871e3d8276a102285ac83d21ef11256d6c3 Mon Sep 17 00:00:00 2001
From: Benjamin Berg <bberg@redhat.com>
Date: Fri, 21 Aug 2020 12:15:47 +0200
Subject: [PATCH 2/2] manager: Always write out parameter
The get_display_and_details_for_bus_sender function does not return a
proper error value. Due to this, it makes sense to always write the out
parameters (though, I expect we have still more that we might need to
write).
This is just slightly safer, but the function probably isn't great as
is.
---
daemon/gdm-manager.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c
index e1bc09b1..012be49d 100644
--- a/daemon/gdm-manager.c
+++ b/daemon/gdm-manager.c
@@ -576,10 +576,11 @@ get_display_and_details_for_bus_sender (GdmManager *self,
lookup_by_session_id,
(gpointer) session_id);
+out:
if (out_display != NULL) {
*out_display = display;
}
-out:
+
g_free (session_id);
}
--
2.30.0