]> git.ipfire.org Git - thirdparty/shadow.git/commit
lib/, src/: Replace strtou[l]l(3) by strtou[l]l_noneg()
authorAlejandro Colomar <alx@kernel.org>
Mon, 11 Dec 2023 00:06:05 +0000 (01:06 +0100)
committerSerge Hallyn <serge@hallyn.com>
Mon, 22 Jan 2024 23:17:15 +0000 (17:17 -0600)
commitf14670ee1a4830a57908cf672e5d386e03556adb
treea86eea5fcec27f9c6948ef236d9f423be98471e0
parent4a2646f67649ad8f8c25159d4c2ff26565d2874a
lib/, src/: Replace strtou[l]l(3) by strtou[l]l_noneg()

strtou[l]l(3) silently converts negative numbers into positive.  This
behavior is wrong: a negative value should be parsed as a negative
value, which would underflow unsigned (long) long, and so would return
the smallest possible value, 0, and set errno to ERANGE to report an
error.

Reviewed-by: Iker Pedrosa <ipedrosa@redhat.com>
Cc: "Serge E. Hallyn" <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/getrange.c
lib/gettime.c
lib/getulong.c
src/check_subid_range.c