[PATCH] xdmcp: Simplify format specifier in XdmcpFatal() for vpnprintf()

Jon TURNEY jon.turney at dronecode.org.uk
Tue Oct 21 07:04:51 PDT 2014


XdmcpFatal uses the format specifier %*.*s, which vpnprintf() doesn't
understand, which causes a backtrace, which prevents the reason for the XDMCP
failure being logged.

See:
https://bugs.freedesktop.org/show_bug.cgi?id=66862
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=758574

Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
---
 os/xdmcp.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/os/xdmcp.c b/os/xdmcp.c
index 99616d9..c5204ad 100644
--- a/os/xdmcp.c
+++ b/os/xdmcp.c
@@ -1409,8 +1409,11 @@ 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 *text = malloc(status->length + 1);
+    strncpy(text, status->data, status->length);
+    text[status->length] = 0;
+    FatalError("XDMCP fatal error: %s %s\n", type, text);
+    free(text);
 }
 
 static void
-- 
2.1.1



More information about the xorg-devel mailing list