Commit d7acfc1f authored by Olivier Duchateau's avatar Olivier Duchateau
Browse files

Fix patches

parent 78d1751c
......@@ -20,20 +20,17 @@
if (fd < 0) {
g_set_error (error,
@@ -441,10 +448,14 @@ _get_auth_info_for_display (GdmDisplayAccessFile *file
@@ -441,9 +448,11 @@ _get_auth_info_for_display (GdmDisplayAccessFile *file
*
* https://bugs.freedesktop.org/show_bug.cgi?id=43425
*/
- char localhost[HOST_NAME_MAX + 1] = "";
+ char *localhost = NULL;
+ size_t name_max = sysconf (_SC_HOST_NAME_MAX) + 1;
+ localhost = malloc (name_max);
+ size_t name_max = sysconf (_SC_HOST_NAME_MAX);
+ char localhost[name_max + 1];
+
*family = FamilyLocal;
- if (gethostname (localhost, HOST_NAME_MAX) == 0) {
+ if (gethostname (localhost, name_max) == 0) {
*address = g_strdup (localhost);
+ free (localhost);
} else {
*address = g_strdup ("localhost");
}
--- daemon/gdm-x-session.c.orig 2020-12-15 18:17:04 UTC
+++ daemon/gdm-x-session.c
@@ -114,18 +114,21 @@ prepare_auth_file (void)
@@ -114,7 +114,8 @@ prepare_auth_file (void)
GError *error = NULL;
gboolean prepared = FALSE;
Xauth auth_entry = { 0 };
- char localhost[HOST_NAME_MAX + 1] = "";
+ char *localhost = NULL;
+ size_t name_max = sysconf (_SC_HOST_NAME_MAX) + 1;
+ size_t name_max = sysconf (_SC_HOST_NAME_MAX);
+ char localhost[name_max + 1];
g_debug ("Preparing auth file for X server");
+ localhost = malloc (name_max);
+
fp = create_auth_file (&filename);
if (fp == NULL) {
@@ -124,7 +125,7 @@ prepare_auth_file (void)
return NULL;
}
- if (gethostname (localhost, HOST_NAME_MAX) < 0) {
- strncpy (localhost, "localhost", sizeof (localhost) - 1);
+ if (gethostname (localhost, name_max) < 0) {
+ strncpy (localhost, "localhost", name_max);
strncpy (localhost, "localhost", sizeof (localhost) - 1);
}
auth_entry.family = FamilyLocal;
@@ -136,6 +139,8 @@ prepare_auth_file (void)
auth_entry.data_length = 16;
auth_entry.data = gdm_generate_random_bytes (auth_entry.data_length, &error);
+
+ free (localhost);
if (error != NULL) {
goto out;
Supports Markdown
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