[gdm] session-record: fix use after free
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdm] session-record: fix use after free
- Date: Fri, 14 Aug 2015 19:23:54 +0000 (UTC)
commit 6f8c1196edcae1dbc72722d57b66fd958fdb7f92
Author: Paul Szabo <psz maths usyd edu au>
Date: Fri Aug 14 14:59:56 2015 -0400
session-record: fix use after free
hostname is getting freed before it's getting used if ut_syslen
is available.
This commit moves the free down a couple of lines
https://bugzilla.gnome.org/show_bug.cgi?id=599103
daemon/gdm-session-record.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
---
diff --git a/daemon/gdm-session-record.c b/daemon/gdm-session-record.c
index 3323252..89c11a8 100644
--- a/daemon/gdm-session-record.c
+++ b/daemon/gdm-session-record.c
@@ -161,11 +161,10 @@ record_set_host (UTMP *u,
if (hostname != NULL) {
strncpy (u->ut_host, hostname, sizeof (u->ut_host));
g_debug ("using ut_host %.*s", (int) sizeof (u->ut_host), u->ut_host);
- g_free (hostname);
-
#ifdef HAVE_UT_UT_SYSLEN
u->ut_syslen = MIN (strlen (hostname), sizeof (u->ut_host));
#endif
+ g_free (hostname);
}
#endif
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]