From: Alejandro Colomar Date: Wed, 8 Jul 2026 23:20:02 +0000 (+0200) Subject: lib/subordinateio.c: Don't rely on id_t being unsigned X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=674cb0f65b1085789208ba220c0399ae29bbdd86;p=thirdparty%2Fshadow.git lib/subordinateio.c: Don't rely on id_t being unsigned POSIX doesn't provide any guarantees about the signedness of id_t. Reported-by: Serge Hallyn Fixes: de7f1c78f70f (2026-04-09; "lib/subordinateio.c: find_free_range(): Use id_t instead of u_long") Reviewed-by: Serge Hallyn Signed-off-by: Alejandro Colomar --- diff --git a/lib/subordinateio.c b/lib/subordinateio.c index 65bcfb707..c900ebc34 100644 --- a/lib/subordinateio.c +++ b/lib/subordinateio.c @@ -28,6 +28,7 @@ #include "string/sprintf/stprintf.h" #include "string/strcmp/streq.h" #include "string/strtok/strsep2arr.h" +#include "typetraits.h" #define ID_SIZE 31 @@ -1044,7 +1045,7 @@ bool new_subid_range(struct subordinate_range *range, enum subid_type id_type, b } } - start = find_free_range(db, range->start, -1, range->count); + start = find_free_range(db, range->start, maxof(id_t), range->count); if (start == -1) { ret = false; goto out;