diff options
Diffstat (limited to 'lib/tdb/common/io.c')
-rw-r--r-- | lib/tdb/common/io.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/tdb/common/io.c b/lib/tdb/common/io.c index 87d47b970b..11dfefd102 100644 --- a/lib/tdb/common/io.c +++ b/lib/tdb/common/io.c @@ -405,6 +405,12 @@ tdb_off_t tdb_expand_adjust(tdb_off_t map_size, tdb_off_t size, int page_size) /* Round the database up to a multiple of the page size */ new_size = MAX(top_size, new_size); + + if (new_size + page_size < new_size) { + /* There's a "+" in TDB_ALIGN that might overflow... */ + goto overflow; + } + return TDB_ALIGN(new_size, page_size) - map_size; overflow: |