diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2018-05-19 19:03:11 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2018-05-19 19:03:11 +0300 |
commit | 0f0c3dba3f676bf7a163586855f07ef427da3b4a (patch) | |
tree | 8805fce40824e051b4ccf74b98b95289e4c1563f /src/mmap.c | |
parent | 625a871bdd3fac33d236d63d6c053e969fdec9d7 (diff) | |
download | gdbm-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.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -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); |