diff options
Diffstat (limited to 'src/falloc.c')
-rw-r--r-- | src/falloc.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/falloc.c b/src/falloc.c index 3f437a6..33a238a 100644 --- a/src/falloc.c +++ b/src/falloc.c @@ -152,7 +152,7 @@ _gdbm_free (GDBM_FILE dbf, off_t file_adr, int num_bytes) /* Gets the avail block at the top of the stack and loads it into the - active avail block. It does a "free" for itself! This can (and is) + active avail block. It does a "free" for itself! This can be (and is) now called even when the avail block is not empty, so we must be smart about things. */ @@ -206,6 +206,13 @@ pop_avail_block (GDBM_FILE dbf) return -1; } + if (!gdbm_avail_block_valid_p (new_blk)) + { + gdbm_set_errno (dbf, GDBM_BAD_AVAIL, TRUE); + _gdbm_fatal (dbf, gdbm_db_strerror (dbf)); + return -1; + } + /* Add the elements from the new block to the header. */ index = 0; while (index < new_blk->count) |