gfs2-utils/0-gfs2_edit_always_use_s_st...

34 lines
1.0 KiB
Diff

commit 17fb470356a6d55988f05ac70f06b382ef982604
Author: Sergei Trofimovich <slyich@gmail.com>
Date: Sun Nov 7 09:00:31 2021 +0000
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.
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++;
}