From 7f77045b6efc507bf1b56b1bd0395b8f0d2772f0 Mon Sep 17 00:00:00 2001 From: Zhiqiang Liu Date: Wed, 2 Mar 2022 12:01:45 +0800 Subject: [PATCH] gdbm: fix stack overflow in print_usage fix stack overflow in print_usage. Fix issue: https://gitee.com/src-openeuler/gdbm/issues/I4RV4Y Signed-off-by: Zhiqiang Liu (cherry picked from commit ca90a8d9d8ce2e18762415e9e30482fed280c6f0) --- ... => 0000-Fix-gdbmtool-import-command.patch | 0 0001-fix-gdbm_dump-usage-stack-overflow.patch | 28 +++++++++++++++++++ gdbm.spec | 8 ++++-- 3 files changed, 34 insertions(+), 2 deletions(-) rename Fix-gdbmtool-import-command.patch => 0000-Fix-gdbmtool-import-command.patch (100%) create mode 100644 0001-fix-gdbm_dump-usage-stack-overflow.patch diff --git a/Fix-gdbmtool-import-command.patch b/0000-Fix-gdbmtool-import-command.patch similarity index 100% rename from Fix-gdbmtool-import-command.patch rename to 0000-Fix-gdbmtool-import-command.patch diff --git a/0001-fix-gdbm_dump-usage-stack-overflow.patch b/0001-fix-gdbm_dump-usage-stack-overflow.patch new file mode 100644 index 0000000..f76c4ef --- /dev/null +++ b/0001-fix-gdbm_dump-usage-stack-overflow.patch @@ -0,0 +1,28 @@ +From 48e22dd008138bb97d2a673af9da5b1b3457c86f Thu Sep 9 08:15:07 2021 +From: Sergey Poznyakoff +Date: Thu, 9 Sep 2021 15:04:27 +0800 +Subject: [PATCH] Fix stack overflow in print_usage + +src/parseopt.c (print_usage): Fix length calculation for long +options. + +Conflict:NA +Reference:https://git.gnu.org.ua/gdbm.git/commit/?id=48e22dd008138bb97d2a673af9da5b1b3457c86f + +--- + src/parseopt.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/parseopt.c b/src/parseopt.c +index bc47597..efa12c8 100644 +--- a/src/parseopt.c ++++ b/src/parseopt.c +@@ -495,7 +495,7 @@ print_usage (void) + { + struct gdbm_option *opt = option_tab + idxbuf[i]; + const char *arg = opt->opt_arg ? gettext (opt->opt_arg) : NULL; +- size_t len = 3 + strlen (opt->opt_long) ++ size_t len = 5 + strlen (opt->opt_long) + + (arg ? 1 + strlen (arg) : 0); + if (n + len > RMARGIN) FLUSH; + buf[n++] = ' '; diff --git a/gdbm.spec b/gdbm.spec index c56a7f5..38705fa 100644 --- a/gdbm.spec +++ b/gdbm.spec @@ -1,13 +1,14 @@ Name: gdbm Version: 1.18.1 -Release: 3 +Release: 4 Epoch: 1 Summary: A library of database functions that work similar to the standard UNIX dbm License: GPLv3+ URL: http://www.gnu.org/software/gdbm/ Source0: http://ftp.gnu.org/gnu/gdbm/gdbm-%{version}.tar.gz -Patch0: Fix-gdbmtool-import-command.patch +Patch0: 0000-Fix-gdbmtool-import-command.patch +Patch1: 0001-fix-gdbm_dump-usage-stack-overflow.patch BuildRequires: gcc libtool gettext readline-devel git @@ -99,6 +100,9 @@ fi %{_infodir}/*.info* %changelog +* Wed Mar 02 2022 Zhiqiang Liu - 1.18.1-4 +- Fix stack overflow in print_usage + * Thu Nov 25 2021 yangchenguang - 1.18.1-3 - Fix gdbmtool parm import error -- Gitee