Blame SOURCES/gdbm-1.18-backward-compatibility.patch

9095a6
Upstream backport: 00ba17479ff31c6825f0e6f28b965f11525e83f6
9095a6
Fix problem with loading old format of databases exports
9095a6
9095a6
diff -ur gdbm-1.18/src/gdbmopen.c gdbm-patch/src/gdbmopen.c
9095a6
--- gdbm-1.18/src/gdbmopen.c	2018-08-03 10:46:39.000000000 +0200
9095a6
+++ gdbm-patch/src/gdbmopen.c	2022-07-01 08:56:08.000000000 +0200
9095a6
@@ -168,9 +168,14 @@
9095a6
       return GDBM_BLOCK_SIZE_ERROR;
9095a6
     }
9095a6
 
9095a6
-  if (hdr->next_block != st->st_size)
9095a6
-    /* FIXME: Should return GDBM_NEED_RECOVERY instead? */
9095a6
-    return GDBM_BAD_HEADER;
9095a6
+  /* Technically speaking, the condition below should read
9095a6
+         hdr->next_block != st->st_size
9095a6
+     However, gdbm versions prior to commit 4e819c98 could leave
9095a6
+     hdr->next_block pointing beyond current end of file. To ensure
9095a6
+     backward compatibility with these versions, the condition has been
9095a6
+     slackened to this: */
9095a6
+  if (hdr->next_block < st->st_size)
9095a6
+     return GDBM_BAD_HEADER;
9095a6
 
9095a6
   /* Make sure dir and dir + dir_size fall within the file boundary */
9095a6
   if (!(hdr->dir > 0