summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/idmap.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/idmap.c b/src/idmap.c
index da7f175c..cc9a4ff1 100644
--- a/src/idmap.c
+++ b/src/idmap.c
@@ -176,6 +176,9 @@ unsigned int idmap_alloc_next(struct idmap *idmap, unsigned int last)
unsigned int bit;
unsigned int offset;
+ if (last < idmap->min || last > idmap->max)
+ return idmap->max + 1;
+
bit = find_next_zero_bit(idmap->bits, idmap->size,
last - idmap->min + 1);