[PATCH xserver] XDMCP: Fix format in XDMCP fatal error printing

Egbert Eich eich at freedesktop.org
Tue Nov 10 02:19:35 PST 2015


From: Egbert Eich <eich at suse.de>

XdmcpFatal() calls FatalError() with '%*.*s' in the format string.
FatalError() uses the async safe versions of printf() which only
support a subset of the POSIX printf formats - they don't contain
the '*' width and precision specifiers.

Bugzilla: https://bugzilla.opensuse.org/show_bug.cgi?id=948713
Signed-off-by: Egbert Eich <eich at suse.de>
---
 os/xdmcp.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/os/xdmcp.c b/os/xdmcp.c
index 5bdcbe9..899e02e 100644
--- a/os/xdmcp.c
+++ b/os/xdmcp.c
@@ -1403,8 +1403,9 @@ _X_NORETURN
 static void
 XdmcpFatal(const char *type, ARRAY8Ptr status)
 {
-    FatalError("XDMCP fatal error: %s %*.*s\n", type,
-               status->length, status->length, status->data);
+    char *msg = strndup((char *)status->data, status->length);
+    FatalError("XDMCP fatal error: %s %s\n", type, msg);
+    /*NOTREACHED*/
 }
 
 static void
-- 
2.5.3



More information about the xorg-devel mailing list