aboutsummaryrefslogtreecommitdiff
path: root/src/mmap.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2018-05-19 19:03:11 +0300
committerSergey Poznyakoff <gray@gnu.org>2018-05-19 19:03:11 +0300
commit0f0c3dba3f676bf7a163586855f07ef427da3b4a (patch)
tree8805fce40824e051b4ccf74b98b95289e4c1563f /src/mmap.c
parent625a871bdd3fac33d236d63d6c053e969fdec9d7 (diff)
downloadgdbm-0f0c3dba3f676bf7a163586855f07ef427da3b4a.tar.gz
gdbm-0f0c3dba3f676bf7a163586855f07ef427da3b4a.tar.bz2
Catch more errors
* src/gdbmdump.c (_gdbm_dump_ascii): Break on errors * src/gdbmopen.c (compute_directory_size): Remove unused argument. (validate_header): Catch dir_size and dir_bits mismatches. * src/mmap.c (_gdbm_mapped_lseek): Bail out on negative offsets. * tests/dump03.at: New test. * tests/dump04.at: New test. * tests/Makefile.am: Add new tests. * tests/testsuite.at: Add new tests.
Diffstat (limited to 'src/mmap.c')
-rw-r--r--src/mmap.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mmap.c b/src/mmap.c
index 9a7d400..114d8b2 100644
--- a/src/mmap.c
+++ b/src/mmap.c
@@ -394,6 +394,12 @@ _gdbm_mapped_lseek (GDBM_FILE dbf, off_t offset, int whence)
}
}
+ if (needle < 0)
+ {
+ errno = EINVAL;
+ return -1;
+ }
+
if (!_GDBM_IN_MAPPED_REGION_P (dbf, needle))
{
_gdbm_mapped_unmap (dbf);

Return to:

Send suggestions and report system problems to the System administrator.