[PATCH 3/4] lib/vsprintf: use int for field_width in vsscanf()

From: Josh Law

Date: Tue Mar 24 2026 - 18:54:39 EST


vsscanf() declares field_width as s16 but assigns it from skip_atoi()
which returns int. Values above 32767 silently truncate to negative,
causing vsscanf() to abort all remaining parsing. This is inconsistent
with struct printf_spec which uses int for field_width.

Change the type to int to match.

Signed-off-by: Josh Law <objecting@xxxxxxxxxxxxx>
---
lib/vsprintf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 72fbfe181076..2758096b6f53 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -3461,7 +3461,7 @@ int vsscanf(const char *buf, const char *fmt, va_list args)
long long s;
unsigned long long u;
} val;
- s16 field_width;
+ int field_width;
bool is_sign;

while (*fmt) {
--
2.34.1