diff options
author | Richard Bradfield <bradfirj@fstab.me> | 2015-05-24 21:48:01 +0100 |
---|---|---|
committer | Ray Strode <rstrode@redhat.com> | 2015-05-27 13:38:51 -0400 |
commit | c229f90449277c475a15d78a697b7fa13884e69b (patch) | |
tree | 1bae5c7ec87c7303e169ca97b186f5424fd59e15 | |
parent | 4b03eb0ff9fe9bf22dde18297d4eb28aa9ed779d (diff) | |
download | gdm-c229f90449277c475a15d78a697b7fa13884e69b.tar.gz |
manager: fix monitor hotplug segfault
commit e5a0e92f59e256edc6489f2234fbe54c25ba9743 introduced a way to
find a user session associated with a display object.
That function has a bug in it, where it skips every even
registered user session because it follows the next pointer
twice per iteration of the loop.
This can cause a crash on monitor hotplug, and in other scenarios
if there are an odd number of user sessions (since the
terminating NULL will be even and skipped over).
https://bugzilla.gnome.org/show_bug.cgi?id=749987
-rw-r--r-- | daemon/gdm-manager.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c index 64f11dd6..5e496f70 100644 --- a/daemon/gdm-manager.c +++ b/daemon/gdm-manager.c @@ -1126,11 +1126,10 @@ static GdmSession * get_user_session_for_display (GdmManager *self, GdmDisplay *display) { - GList *node; - for (node = self->priv->user_sessions; - node != NULL; - node = node->next) { + GList *node = self->priv->user_sessions; + + while (node != NULL) { GdmSession *session = node->data; GdmDisplay *candidate_display; GList *next_node = node->next; |