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

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