gfs2-utils/0001-gfs2-edit-always-use-s-style-format-for-printf-style.patch

40 lines
1.1 KiB
Diff
Raw Normal View History

2022-04-07 17:22:27 +08:00
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