console: avoid buffer overrun in guest_console_write()
authorJan Beulich <jbeulich@suse.com>
Fri, 29 Nov 2019 16:09:16 +0000 (17:09 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 29 Nov 2019 16:09:16 +0000 (17:09 +0100)
commit0ef3ad971275c30355245299998faddfada51726
tree9cc046e65b7f34b7fada34aea10a6ea5d4c7e2c0
parentaaf8839fdf8b9b1a93a3837b82f680adea1b297c
console: avoid buffer overrun in guest_console_write()

conring_puts() has been requiring a nul-terminated string, which the
local kbuf[] doesn't get set for anymore. Add a length parameter to the
function, just like was done for others, thus allowing embedded nul to
also be read through XEN_SYSCTL_readconsole.

While there drop a stray cast: Both operands of - are already uint32_t.

Fixes: ea601ec9995b ("xen/console: Rework HYPERCALL_console_io interface")
Reported-by: Jürgen Groß <jgross@suse.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Acked-by: Julien Grall <julien@xen.org>
xen/drivers/char/console.c