summaryrefslogtreecommitdiffstats
path: root/trunk/v2-xserver-Fix-a-crash-with-XDMCP-error-handler.patch
blob: 02dbaf22f93f7b1f914eedffff113aa3702d63c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
diff --git a/os/xdmcp.c b/os/xdmcp.c
index b6e97c9..0e9e625 100644
--- a/os/xdmcp.c
+++ b/os/xdmcp.c
@@ -1409,8 +1409,16 @@ recv_alive_msg(unsigned length)
 static void
 XdmcpFatal(const char *type, ARRAY8Ptr status)
 {
-    FatalError("XDMCP fatal error: %s %*.*s\n", type,
-               status->length, status->length, status->data);
+    char *error_message;
+
+    /* error_message is leaked, but that's fine, we're aborting */
+    error_message = malloc (status->length + 1);
+    if (!error_message)
+        FatalError("XDMCP fatal error: %s", type);
+
+    memcpy(error_message, status->data, status->length);
+    error_message[status->length] = '\0';
+    FatalError("XDMCP fatal error: %s %s\n", type, error_message);
 }
 
 static void

Copyright © 2002-2014 Judd Vinet and Aaron Griffin. The Arch Linux name and logo are recognized trademarks. Some rights reserved. The registered trademark Linux® is used pursuant to a sublicense from LMI, the exclusive licensee of Linus Torvalds, owner of the mark on a world-wide basis.