]> xenbits.xensource.com Git - people/sstabellini/xen-unstable.git/.git/commit
console: avoid buffer overflow in guest_console_write()
authorJan Beulich <jbeulich@suse.com>
Fri, 29 Nov 2019 16:08:20 +0000 (17:08 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 29 Nov 2019 16:08:20 +0000 (17:08 +0100)
commitaaf8839fdf8b9b1a93a3837b82f680adea1b297c
tree90d93d5b09f428880fa6cc18e59ccdebaabd0dd6
parentc7d52a5be62ea253a9baac68510683c47efbcb8c
console: avoid buffer overflow in guest_console_write()

The switch of guest_console_write()'s second parameter from plain to
unsigned int has caused the function's main loop header to no longer
guard the min_t() use within the function against effectively negative
values, due to the casts hidden inside the macro. Replace by a plain
min(), casting one of the arguments as necessary.

Fixes: ea601ec9995b ("xen/console: Rework HYPERCALL_console_io interface")
Reported-by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Julien Grall <julien@xen.org>
xen/drivers/char/console.c