Commit 6f8c1196 authored by Paul Szabo's avatar Paul Szabo Committed by Ray Strode

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
parent 0539a8ba
......@@ -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
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment