From 491f6618b54f124fe10e22b8b96ed40e7c8d5635 Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Mon, 20 Apr 2026 12:36:19 +0200 Subject: [PATCH] ns16550: harden positional parsing Advancing past a character without knowing whether that's the NUL char is at risk of reading beyond the buffer. Fixes: 25de1f692059 ("Allow arch-specific defaults to be specified for ns16550") Reported-by: Kamil Frankowicz Signed-off-by: Jan Beulich Acked-by: Andrew Cooper master commit: 2c43b5611ffbe35611dd391c949f7cb15e1b29e7 master date: 2026-04-07 13:54:19 +0200 --- xen/drivers/char/ns16550.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c index ea35caf034..b443714c10 100644 --- a/xen/drivers/char/ns16550.c +++ b/xen/drivers/char/ns16550.c @@ -1529,6 +1529,9 @@ static bool __init parse_positional(struct ns16550 *uart, char **str) { uart->data_bits = simple_strtoul(conf, &conf, 10); + if ( !*conf ) + PARSE_ERR_RET("bad DPS setting"); + uart->parity = parse_parity_char(*conf); uart->stop_bits = simple_strtoul(conf + 1, &conf, 10);