From 7cd920a4995599a603a1788e1eccb494ebe2bd3b Mon Sep 17 00:00:00 2001 From: yangchen_guang Date: Tue, 21 Dec 2021 16:06:22 +0800 Subject: [PATCH] Fix gdbmtool parm import error --- Fix-gdbmtool-import-command.patch | 36 +++++++++++++++++++++++++++++++ gdbm.spec | 6 +++++- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 Fix-gdbmtool-import-command.patch diff --git a/Fix-gdbmtool-import-command.patch b/Fix-gdbmtool-import-command.patch new file mode 100644 index 0000000..91d9339 --- /dev/null +++ b/Fix-gdbmtool-import-command.patch @@ -0,0 +1,36 @@ +From 4f456e7c4b9e3727a83bc3d30ac929402f7ef81a Mon Sep 17 00:00:00 2001 +From: yangchenguang +Date: Fri, 19 Nov 2021 10:44:24 +0800 +Subject: [PATCH] Fix gdbmtool import command + +* src/gdbmtool.c (import_handler): Fix option addressing (see +https://puszcza.gnu.org.ua/bugs/?535). +Fix freeing of the uninitialized variable. +--- + src/gdbmtool.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/src/gdbmtool.c b/src/gdbmtool.c +index bbadbae..03ba482 100644 +--- a/src/gdbmtool.c ++++ b/src/gdbmtool.c +@@ -1003,7 +1003,7 @@ import_handler (struct handler_param *param) + int i; + int rc; + +- for (i = 0; i < param->argc; i++) ++ for (i = 1; i < param->argc; i++) + { + if (strcmp (PARAM_STRING (param, i), "replace") == 0) + flag = GDBM_REPLACE; +@@ -1054,7 +1054,6 @@ import_handler (struct handler_param *param) + return; + } + +- free (file_name); + if (gdbm_setopt (gdbm_file, GDBM_GETDBNAME, &file_name, sizeof (file_name))) + terror (_("gdbm_setopt failed: %s"), gdbm_strerror (gdbm_errno)); + } +-- +2.20.1 + diff --git a/gdbm.spec b/gdbm.spec index 04936e4..83247b1 100644 --- a/gdbm.spec +++ b/gdbm.spec @@ -3,7 +3,7 @@ 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/ @@ -18,6 +18,7 @@ Source: http://ftp.gnu.org/gnu/gdbm/gdbm-%{version}.tar.gz #Patch1: gdbm-1.10-fedora.patch Patch2: gdbm-1.17-coverity-fixes.patch +Patch3: Fix-gdbmtool-import-command.patch BuildRequires: gcc BuildRequires: libtool @@ -125,6 +126,9 @@ fi %{_mandir}/man3/* %changelog +* Tue Dec 21 2021 yangchenguang - 1:1.18-2 +- Fix gdbmtool parm import error + * Mon Sep 03 2018 mskalick@redhat.com - 1:1.18-1 - Rebase to latest release 1.18 - Fix issues found by coverity -- Gitee