fix some error

This commit is contained in:
penelope 2022-03-11 09:50:08 +08:00
parent cbb0719b65
commit 1152905fef
3 changed files with 70 additions and 2 deletions

View File

@ -0,0 +1,39 @@
From 17fb470356a6d55988f05ac70f06b382ef982604 Mon Sep 17 00:00:00 2001
From: Sergei Trofimovich <slyich@gmail.com>
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

View File

@ -0,0 +1,25 @@
From f2cced91a440de26b30adf6a82f8bd459a04a4c2 Mon Sep 17 00:00:00 2001
From: penelope <anchor_cool@163.com>
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

View File

@ -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 <yangping69@huawei.com> - 3.2.0-6
- Fix some error format arguments
* Tue Jan 21 2020 daiqianwen <daiqianwen@huawei.com> - 3.2.0-5
- Type:bugfix
- ID:NA