From 36ffd71d7ff9738af5deafa5b393f6dd2f0bdc09 Mon Sep 17 00:00:00 2001 From: yanxiaodan Date: Fri, 24 Jun 2022 12:42:16 +0000 Subject: [PATCH 1/3] gdbm_dump fix command line error detection --- ...ump-fix-command-line-error-detection.patch | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 gdbm_dump-fix-command-line-error-detection.patch diff --git a/gdbm_dump-fix-command-line-error-detection.patch b/gdbm_dump-fix-command-line-error-detection.patch new file mode 100644 index 0000000..0e248e3 --- /dev/null +++ b/gdbm_dump-fix-command-line-error-detection.patch @@ -0,0 +1,72 @@ +From c96c160375bd1f3861651311e8645fb6478a1ffd Mon Sep 17 00:00:00 2001 +From: Sergey Poznyakoff +Date: Mon, 20 Jun 2022 11:50:46 +0300 +Subject: [PATCH] gdbm_dump: fix command line error detection + +This fixes https://puszcza.gnu.org.ua/bugs/?567 +--- + src/gdbm_dump.c | 23 +++++++++++++++++------ + 1 file changed, 17 insertions(+), 6 deletions(-) + +diff --git a/src/gdbm_dump.c b/src/gdbm_dump.c +index a480152..2f37eac 100644 +--- a/src/gdbm_dump.c ++++ b/src/gdbm_dump.c +@@ -57,19 +57,31 @@ main (int argc, char **argv) + format = GDBM_DUMP_FMT_ASCII; + else + { +- format = atoi (optarg); +- switch (format) ++ char *p; ++ unsigned long n; ++ ++ errno = 0; ++ n = strtoul (optarg, &p, 10); ++ if (errno || *p != 0) ++ { ++ error (_("unknown dump format")); ++ exit (EXIT_USAGE); ++ } ++ ++ switch (n) + { + case GDBM_DUMP_FMT_BINARY: + case GDBM_DUMP_FMT_ASCII: ++ format = n; + break; ++ + default: + error (_("unknown dump format")); + exit (EXIT_USAGE); + } + } + break; +- ++ + default: + error (_("unknown option")); + exit (EXIT_USAGE); +@@ -90,7 +102,7 @@ main (int argc, char **argv) + error (_("too many arguments; try `%s -h' for more info"), progname); + exit (EXIT_USAGE); + } +- ++ + dbname = argv[0]; + if (argc == 2) + filename = argv[1]; +@@ -124,9 +136,8 @@ main (int argc, char **argv) + { + gdbm_perror (_("dump error"), filename); + } +- ++ + gdbm_close (dbf); + + exit (rc == GDBM_NO_ERROR ? EXIT_OK : EXIT_FATAL); + } +- +-- +1.8.3.1 + -- Gitee From 5fba8497277800d39fcbfa33f8c7d028ffa7e04f Mon Sep 17 00:00:00 2001 From: yanxiaodan Date: Fri, 24 Jun 2022 12:46:16 +0000 Subject: [PATCH 2/3] update gdbm.spec. --- gdbm.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gdbm.spec b/gdbm.spec index 38705fa..070ebfd 100644 --- a/gdbm.spec +++ b/gdbm.spec @@ -1,6 +1,6 @@ Name: gdbm Version: 1.18.1 -Release: 4 +Release: 5 Epoch: 1 Summary: A library of database functions that work similar to the standard UNIX dbm License: GPLv3+ @@ -9,6 +9,7 @@ Source0: http://ftp.gnu.org/gnu/gdbm/gdbm-%{version}.tar.gz Patch0: 0000-Fix-gdbmtool-import-command.patch Patch1: 0001-fix-gdbm_dump-usage-stack-overflow.patch +Patch2: gdbm_dump-fix-command-line-error-detection.patch BuildRequires: gcc libtool gettext readline-devel git @@ -100,6 +101,9 @@ fi %{_infodir}/*.info* %changelog +* Fri Jun 24 2022 yanxiaodan - 1.18.1-5 +- gdbm_dump-fix-command-line-error-detection + * Wed Mar 02 2022 Zhiqiang Liu - 1.18.1-4 - Fix stack overflow in print_usage -- Gitee From fbf73ba5e36e95ff4464f33bab471f8c0db8369f Mon Sep 17 00:00:00 2001 From: yanxiaodan Date: Fri, 24 Jun 2022 12:57:09 +0000 Subject: [PATCH 3/3] update gdbm.spec. --- gdbm.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdbm.spec b/gdbm.spec index 070ebfd..7c17be4 100644 --- a/gdbm.spec +++ b/gdbm.spec @@ -101,7 +101,7 @@ fi %{_infodir}/*.info* %changelog -* Fri Jun 24 2022 yanxiaodan - 1.18.1-5 +* Fri Jun 24 2022 yanxiaodan - 1:1.18.1-5 - gdbm_dump-fix-command-line-error-detection * Wed Mar 02 2022 Zhiqiang Liu - 1.18.1-4 -- Gitee