summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org>2018-10-18 17:33:10 (GMT)
committer Sergey Poznyakoff <gray@gnu.org>2018-10-18 17:33:10 (GMT)
commit00ba17479ff31c6825f0e6f28b965f11525e83f6 (patch) (side-by-side diff)
treefea289bb407672a6c03f73e7ba1157a0d32ae86d
parent852ff1b6e81ce13fdcd1fd4fb272b17d760760b3 (diff)
downloadgdbm-00ba17479ff31c6825f0e6f28b965f11525e83f6.tar.gz
gdbm-00ba17479ff31c6825f0e6f28b965f11525e83f6.tar.bz2
Restore backward compatibility with older databases
* src/gdbmopen.c (validate_header): Silently accept databases with next_block pointing beyond end of file.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--src/gdbmopen.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/gdbmopen.c b/src/gdbmopen.c
index fe2527e..42f429d 100644
--- a/src/gdbmopen.c
+++ b/src/gdbmopen.c
@@ -171,3 +171,9 @@ validate_header (gdbm_file_header const *hdr, struct stat const *st)
- if (hdr->next_block != st->st_size)
+ /* Technically speaking, the condition below should read
+ hdr->next_block != st->st_size
+ However, gdbm versions prior to commit 4e819c98 could leave
+ hdr->next_block pointing beyond current end of file. To ensure
+ backward compatibility with these versions, the condition has been
+ slackened to this: */
+ if (hdr->next_block < st->st_size)
result = GDBM_NEED_RECOVERY;

Return to:

Send suggestions and report system problems to the System administrator.