[Pkg-shadow-devel] [PATCH] newuidmap, newgidmap: Correct the range size sanity check in get_map_ranges
Eric W. Biederman
ebiederm at xmission.com
Sun Sep 8 09:49:52 UTC 2013
The number of ranges should be the ceiling of the number of arguments divided
by three.
Without this fix newuidmap and newgidmap always report and error and fail,
which is very much not what we want.
Signed-off-by: "Eric W. Biederman" <ebiederm at xmission.com>
---
libmisc/idmapping.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libmisc/idmapping.c b/libmisc/idmapping.c
index 81e85d5..714c29e 100644
--- a/libmisc/idmapping.c
+++ b/libmisc/idmapping.c
@@ -47,7 +47,7 @@ struct map_range *get_map_ranges(int ranges, int argc, char **argv)
return NULL;
}
- if (ranges != ((argc - 2) + 2) / 3) {
+ if (ranges != ((argc + 2) / 3)) {
fprintf(stderr, "%s: ranges: %u is wrong for argc: %d\n", Prog, ranges, argc);
return NULL;
}
--
1.7.10.4
More information about the Pkg-shadow-devel
mailing list