x86, hvm: Limit output debug port to printable characters.
authorKeir Fraser <keir.fraser@citrix.com>
Tue, 20 Jan 2009 16:41:29 +0000 (16:41 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Tue, 20 Jan 2009 16:41:29 +0000 (16:41 +0000)
In particular, '\r' was causing output corruption, and it's not
actually needed.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
xen/arch/x86/hvm/hvm.c

index 0d13a79a5f0c811b5565e15d4402e3631582b376..ff531e3ae2771b0b8509a0936ee455cded8f27ab 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 #include <xen/config.h>
+#include <xen/ctype.h>
 #include <xen/init.h>
 #include <xen/lib.h>
 #include <xen/trace.h>
@@ -273,6 +274,10 @@ static int hvm_print_line(
 
     BUG_ON(bytes != 1);
 
+    /* Accept only printable characters, newline, and horizontal tab. */
+    if ( !isprint(c) && (c != '\n') && (c != '\t') )
+        return X86EMUL_OKAY;
+
     spin_lock(&hd->pbuf_lock);
     hd->pbuf[hd->pbuf_idx++] = c;
     if ( (hd->pbuf_idx == (sizeof(hd->pbuf) - 2)) || (c == '\n') )