summaryrefslogtreecommitdiffabout
path: root/src/findkey.c
Unidiff
Diffstat (limited to 'src/findkey.c') (more/less context) (ignore whitespace changes)
-rw-r--r--src/findkey.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/findkey.c b/src/findkey.c
index 7638b04..bd9fd83 100644
--- a/src/findkey.c
+++ b/src/findkey.c
@@ -24,3 +24,17 @@
24 24
25 25int
26gdbm_bucket_element_valid_p (GDBM_FILE dbf, int elem_loc)
27{
28 return
29 elem_loc < dbf->header->bucket_elems
30 && dbf->bucket->h_table[elem_loc].hash_value != -1
31 && dbf->bucket->h_table[elem_loc].key_size >= 0
32 && off_t_sum_ok (dbf->bucket->h_table[elem_loc].data_pointer,
33 dbf->bucket->h_table[elem_loc].key_size)
34 && dbf->bucket->h_table[elem_loc].data_size >= 0
35 && off_t_sum_ok (dbf->bucket->h_table[elem_loc].data_pointer
36 + dbf->bucket->h_table[elem_loc].key_size,
37 dbf->bucket->h_table[elem_loc].data_size);
38}
39
26/* Read the data found in bucket entry ELEM_LOC in file DBF and 40/* Read the data found in bucket entry ELEM_LOC in file DBF and
@@ -36,3 +50,3 @@ _gdbm_read_entry (GDBM_FILE dbf, int elem_loc)
36 data_cache_elem *data_ca; 50 data_cache_elem *data_ca;
37 51
38 /* Is it already in the cache? */ 52 /* Is it already in the cache? */
@@ -41,2 +55,8 @@ _gdbm_read_entry (GDBM_FILE dbf, int elem_loc)
41 55
56 if (!gdbm_bucket_element_valid_p (dbf, elem_loc))
57 {
58 GDBM_SET_ERRNO (dbf, GDBM_BAD_HASH_TABLE, TRUE);
59 return NULL;
60 }
61
42 /* Set sizes and pointers. */ 62 /* Set sizes and pointers. */

Return to:

Send suggestions and report system problems to the System administrator.