From: Eric W. Biederman Date: Sun, 8 Sep 2013 09:49:52 +0000 (-0700) Subject: newuidmap,newgidmap: Correct the range size sanity check in get_map_ranges X-Git-Tag: 4.2.1^0 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=578947e6614aae91e2550c83790e79479b951e40;p=shadow 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 --- 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; }