diff --git a/SOURCES/gdbm-1.18-backward-compatibility.patch b/SOURCES/gdbm-1.18-backward-compatibility.patch
new file mode 100644
index 0000000..4b5b922
--- /dev/null
+++ b/SOURCES/gdbm-1.18-backward-compatibility.patch
@@ -0,0 +1,24 @@
+Upstream backport: 00ba17479ff31c6825f0e6f28b965f11525e83f6
+Fix problem with loading old format of databases exports
+
+diff -ur gdbm-1.18/src/gdbmopen.c gdbm-patch/src/gdbmopen.c
+--- gdbm-1.18/src/gdbmopen.c	2018-08-03 10:46:39.000000000 +0200
++++ gdbm-patch/src/gdbmopen.c	2022-07-01 08:56:08.000000000 +0200
+@@ -168,9 +168,14 @@
+       return GDBM_BLOCK_SIZE_ERROR;
+     }
+ 
+-  if (hdr->next_block != st->st_size)
+-    /* FIXME: Should return GDBM_NEED_RECOVERY instead? */
+-    return GDBM_BAD_HEADER;
++  /* 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)
++     return GDBM_BAD_HEADER;
+ 
+   /* Make sure dir and dir + dir_size fall within the file boundary */
+   if (!(hdr->dir > 0
diff --git a/SPECS/gdbm.spec b/SPECS/gdbm.spec
index 04936e4..fc695b2 100644
--- a/SPECS/gdbm.spec
+++ b/SPECS/gdbm.spec
@@ -3,21 +3,16 @@
 Summary: A GNU set of database routines which use extensible hashing
 Name: gdbm
 Version: 1.18
-Release: 1%{?dist}
+Release: 2%{?dist}
 Epoch: 1
 License: GPLv3+
 URL: http://www.gnu.org/software/gdbm/
 
 Source: http://ftp.gnu.org/gnu/gdbm/gdbm-%{version}.tar.gz
-# See https://bugzilla.redhat.com/show_bug.cgi?id=4457
-# Upstream bug http://puszcza.gnu.org.ua/bugs/?func=detailitem&item_id=151
-# Fixed in http://cvs.gnu.org.ua/viewvc/gdbm/gdbm/src/gdbmopen.c?r1=1.12&r2=1.13
-# - version 1.10
-#Patch0: gdbm-1.10-zeroheaders.patch
-# NOTE-WARNING file doesn't contain distro dependent largefile note now
-#Patch1: gdbm-1.10-fedora.patch
 
-Patch2: gdbm-1.17-coverity-fixes.patch
+Patch1: gdbm-1.17-coverity-fixes.patch
+# Backport of upstream commit: 00ba17479ff31c6825f0e6f28b965f11525e83f6
+Patch2: gdbm-1.18-backward-compatibility.patch
 
 BuildRequires: gcc
 BuildRequires: libtool
@@ -58,6 +53,7 @@ gdbm database library.  You'll also need to install the gdbm package.
 
 %prep
 %setup -q
+%patch1 -p1
 %patch2 -p1
 
 %build
@@ -125,6 +121,11 @@ fi
 %{_mandir}/man3/* 
 
 %changelog
+* Fri Jul 01 2022 <fjanus@redhat.com> - 1.18-2
+- Add backward compatibility patch
+- Resolves: #2097704
+- Backport from upstream commit: 00ba17479ff31c6825f0e6f28b965f11525e83f6
+
 * Mon Sep 03 2018 mskalick@redhat.com - 1:1.18-1
 - Rebase to latest release 1.18
 - Fix issues found by coverity