>From e4bf8617986be20d979e9519b33ed1cdc7fb848c Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Wed, 25 Nov 2026 11:50:39 -0500 Subject: [PATCH] shadow: fix integer overflow parsing numeric fields this was largely benign, but UB and potentially trapped in builds hardened to trap on integer overflow. use an unsigned accumulator to avoid the problem. --- src/passwd/getspnam_r.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/passwd/getspnam_r.c b/src/passwd/getspnam_r.c index 541e8531..bb45c1b9 100644 --- a/src/passwd/getspnam_r.c +++ b/src/passwd/getspnam_r.c @@ -14,7 +14,7 @@ static long xatol(char **s) { - long x; + unsigned long x; if (**s == ':' || **s == '\n') return -1; for (x=0; **s-'0'<10U; ++*s) x=10*x+(**s-'0'); return x; -- 2.21.0