summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas François <nicolas.francois@centraliens.net>2013-08-15 17:03:18 +0200
committerNicolas François <nicolas.francois@centraliens.net>2013-08-15 17:30:19 +0200
commit5917347c6ffc0f8a7d7bc2cb640600024a2552d6 (patch)
treed593263a2abd1bb4122037f8fa1d0791a9e2fb6f
parent7d5732cb495cedd491e4345373795b3b546a8d36 (diff)
Fix boundary conditions.
* lib/subordinateio.c (find_free_range): max is allowed for new ranges.
-rw-r--r--ChangeLog5
-rw-r--r--lib/subordinateio.c7
2 files changed, 10 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 7ae37b1a..910d02f1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2013-08-15 Nicolas François <nicolas.francois@centraliens.net>
+ * lib/subordinateio.c (find_free_range): max is allowed for new
+ ranges.
+
+2013-08-15 Nicolas François <nicolas.francois@centraliens.net>
+
* libmisc/find_new_sub_gids.c: Remove dead code.
find_new_sub_gids() is always called with *range_count set to 0.
It's more difficult to keep the subordinate GIDs and UIDs
diff --git a/lib/subordinateio.c b/lib/subordinateio.c
index e79d9e57..9eff5fbf 100644
--- a/lib/subordinateio.c
+++ b/lib/subordinateio.c
@@ -225,8 +225,11 @@ static unsigned long find_free_range(struct commonio_db *db,
/* Find the top end of the hole before this range */
high = first;
- if (high > max)
- high = max;
+
+ /* Don't allocate IDs after max (included) */
+ if (high > max + 1) {
+ high = max + 1;
+ }
/* Is the hole before this range large enough? */
if ((high > low) && ((high - low) >= count))