From afb919ff6ae38f797c162bf1c5d7b3d5abbd5e32 Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Mon, 20 Apr 2026 12:26:25 +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 96e837afe8..1f95618cf6 100644 --- a/xen/drivers/char/ns16550.c +++ b/xen/drivers/char/ns16550.c @@ -1547,6 +1547,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);