From 1152905fefa2b02af19550fefe662815381c29d4 Mon Sep 17 00:00:00 2001 From: penelope Date: Fri, 11 Mar 2022 09:50:08 +0800 Subject: [PATCH] fix some error --- ...-use-s-style-format-for-printf-style.patch | 39 +++++++++++++++++++ 0002-fix-error-format-in-gfs2hex.patch | 25 ++++++++++++ gfs2-utils.spec | 8 +++- 3 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 0001-gfs2-edit-always-use-s-style-format-for-printf-style.patch create mode 100644 0002-fix-error-format-in-gfs2hex.patch diff --git a/0001-gfs2-edit-always-use-s-style-format-for-printf-style.patch b/0001-gfs2-edit-always-use-s-style-format-for-printf-style.patch new file mode 100644 index 0000000..77d6caa --- /dev/null +++ b/0001-gfs2-edit-always-use-s-style-format-for-printf-style.patch @@ -0,0 +1,39 @@ +From 17fb470356a6d55988f05ac70f06b382ef982604 Mon Sep 17 00:00:00 2001 +From: Sergei Trofimovich +Date: Sun, 7 Nov 2021 09:00:31 +0000 +Subject: [PATCH] gfs2/edit: always use "%s"-style format for printf()-style + functions + +`ncurses-6.3` added printf-style function attributes and now makes +it easier to catch cases when user input is used in place of format +string when built with CFLAGS=-Werror=format-security: + + hexedit.c:227:9: error: format not a string literal and no format arguments [-Werror=format-security] + 227 | printw(s2); + | ^~~~~~ + +Let's wrap all the missing places with "%s" format. +--- + gfs2/edit/hexedit.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c +index 798639b5..88ee3e5f 100644 +--- a/gfs2/edit/hexedit.c ++++ b/gfs2/edit/hexedit.c +@@ -221,10 +221,10 @@ static void gfs2instr(const char *s1, const char *s2) + { + COLORS_HIGHLIGHT; + move(line,0); +- printw(s1); ++ printw("%s", s1); + COLORS_NORMAL; + move(line,17); +- printw(s2); ++ printw("%s", s2); + line++; + } + +-- +2.27.0 + diff --git a/0002-fix-error-format-in-gfs2hex.patch b/0002-fix-error-format-in-gfs2hex.patch new file mode 100644 index 0000000..27ef0a4 --- /dev/null +++ b/0002-fix-error-format-in-gfs2hex.patch @@ -0,0 +1,25 @@ +From f2cced91a440de26b30adf6a82f8bd459a04a4c2 Mon Sep 17 00:00:00 2001 +From: penelope +Date: Thu, 10 Mar 2022 21:30:47 +0800 +Subject: [PATCH] fix error format in gfs2hex + +--- + gfs2/edit/gfs2hex.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gfs2/edit/gfs2hex.c b/gfs2/edit/gfs2hex.c +index 62d5cab..b8c027e 100644 +--- a/gfs2/edit/gfs2hex.c ++++ b/gfs2/edit/gfs2hex.c +@@ -376,7 +376,7 @@ static void gfs2_inum_print2(const char *title,struct gfs2_inum *no) + if (termlines) { + check_highlight(TRUE); + move(line,2); +- printw(title); ++ printw("%s",title); + check_highlight(FALSE); + } + else +-- +2.27.0 + diff --git a/gfs2-utils.spec b/gfs2-utils.spec index 892d5d2..41da928 100644 --- a/gfs2-utils.spec +++ b/gfs2-utils.spec @@ -1,11 +1,13 @@ Name: gfs2-utils Version: 3.2.0 -Release: 5 +Release: 6 Summary: Global Filesystem Utilities License: GPLv2+ and LGPLv2+ URL: https://pagure.io/gfs2-utils Source0: https://releases.pagure.org/gfs2-utils/gfs2-utils-%{version}.tar.gz +Patch0: 0001-gfs2-edit-always-use-s-style-format-for-printf-style.patch +Patch1: 0002-fix-error-format-in-gfs2hex.patch BuildRequires: ncurses-devel kernel-headers automake libtool zlib-devel gettext-devel BuildRequires: bison flex libblkid-devel libuuid-devel check-devel @@ -16,7 +18,6 @@ modifying, and correcting inconsistencies in GFS2 file systems. %package_help - %prep %autosetup -n %{name}-%{version} -p1 @@ -51,6 +52,9 @@ make -C gfs2 install DESTDIR=%{buildroot} %exclude %{_mandir}/man8/gfs2_lockcapture.8.gz %changelog +* Fri Mar 11 2022 yangping - 3.2.0-6 +- Fix some error format arguments + * Tue Jan 21 2020 daiqianwen - 3.2.0-5 - Type:bugfix - ID:NA -- Gitee