aboutsummaryrefslogtreecommitdiff
path: root/src/gdbmtool.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2018-05-24 13:47:50 +0200
committerSergey Poznyakoff <gray@gnu.org>2018-05-24 13:47:50 +0200
commitb001c227fdf02e3ed1e87161cbc1dec4a1184203 (patch)
treecf2135c91a76a9642d497b77e41857add4d6a496 /src/gdbmtool.c
parente01d90f2cdebaa2a3543aa651b92e9d397a3bf77 (diff)
downloadgdbm-b001c227fdf02e3ed1e87161cbc1dec4a1184203.tar.gz
gdbm-b001c227fdf02e3ed1e87161cbc1dec4a1184203.tar.bz2
More input checking fixes
* src/gdbmdefs.h (gdbm_avail_block_valid_p): Minimal capacity of an avail_block is 1 (one entry is stored in the block itself). * src/gdbmopen.c (gdbm_avail_table_valid_p): New function. (validate_header): Fix verification of dir_size and dir_bits. Verify avail.size. * src/falloc.c (pop_avail_block): Use gdbm_avail_table_valid_p * src/gdbmtool.c (_gdbm_print_avail_list): Likewise.
Diffstat (limited to 'src/gdbmtool.c')
-rw-r--r--src/gdbmtool.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/gdbmtool.c b/src/gdbmtool.c
index 9c6eebe..575b97b 100644
--- a/src/gdbmtool.c
+++ b/src/gdbmtool.c
@@ -259,8 +259,8 @@ _gdbm_print_avail_list (FILE *fp, GDBM_FILE dbf)
/* Initialize the variables for a pass throught the avail stack. */
temp = dbf->header->avail.next_block;
- size = (((dbf->header->avail.size * sizeof (avail_elem)) >> 1)
- + sizeof (avail_block));
+ size = (dbf->header->avail.size * sizeof (avail_elem))
+ + sizeof (avail_block);
av_stk = emalloc (size);
/* Print the stack. */
@@ -281,7 +281,7 @@ _gdbm_print_avail_list (FILE *fp, GDBM_FILE dbf)
/* Print the block! */
fprintf (fp, _("\nblock = %d\nsize = %d\ncount = %d\n"), temp,
av_stk->size, av_stk->count);
- if (gdbm_avail_block_valid_p (av_stk))
+ if (gdbm_avail_table_valid_p (dbf, av_stk))
av_table_display (av_stk->av_table, av_stk->count, fp);
else
terror (_("invalid avail_block"));

Return to:

Send suggestions and report system problems to the System administrator.