From 578947e6614aae91e2550c83790e79479b951e40 Mon Sep 17 00:00:00 2001 From: "Eric W. Biederman" Date: Sun, 8 Sep 2013 02:49:52 -0700 Subject: [PATCH] newuidmap,newgidmap: Correct the range size sanity check in get_map_ranges 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" Signed-off-by: Serge Hallyn --- libmisc/idmapping.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmisc/idmapping.c b/libmisc/idmapping.c index 81e85d5f..714c29eb 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; }