diff options
author | Denis Kenzior <denkenz@gmail.com> | 2010-01-07 14:42:46 -0600 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2010-01-07 14:42:46 -0600 |
commit | 230bddf30ede8110049b149c844ffad34d140498 (patch) | |
tree | f1f3ba4f1d6b4320bea93441143ebf50bdcdf4f4 /src/idmap.c | |
parent | bdfa90bd1440000d6b16b2efc67370e09ad3642f (diff) | |
download | ofono-230bddf30ede8110049b149c844ffad34d140498.tar.bz2 |
Fix: Be paranoid and check that last is in range
Diffstat (limited to 'src/idmap.c')
-rw-r--r-- | src/idmap.c | 3 |
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); |