According to [0], some program sends NUL for padding purpose. We can
discard them.

https://www.gnu.org/software/termutils/manual/termcap-1.3/html_mono/termcap.html#SEC7

Reported-by: Sarah Newman <s...@prgmr.com>
Signed-off-by: Wei Liu <wei.l...@citrix.com>
---
Cc: Sarah Newman <s...@prgmr.com>
Cc: Jan Beulich <jbeul...@suse.com>
Cc: Andrew Cooper <andrew.coop...@citrix.com>
Cc: Ian Jackson <ian.jack...@eu.citrix.com>

A bit RFC. Awaiting test results.
---
 xen/drivers/char/consoled.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/char/consoled.c b/xen/drivers/char/consoled.c
index 552abf5766..6fcb2aa115 100644
--- a/xen/drivers/char/consoled.c
+++ b/xen/drivers/char/consoled.c
@@ -72,7 +72,9 @@ size_t consoled_guest_rx(void)
     {
         char c = cons_ring->out[MASK_XENCONS_IDX(cons++, cons_ring->out)];
 
-        buf[idx++] = c;
+        /* Discard NUL. See the "Padding" section of termcap manual. */
+        if ( c != '\0' )
+            buf[idx++] = c;
         recv++;
 
         if ( idx >= BUF_SZ )
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to