Skip to content

Commit

Permalink
app-i18n/freewnn: fix build with -Werror=format-security
Browse files Browse the repository at this point in the history
Gentoo-Bug: 521056

Package-Manager: Portage-2.3.6, Repoman-2.3.1
  • Loading branch information
hattya committed Jul 18, 2017
1 parent c7a4fb4 commit 4df816e
Show file tree
Hide file tree
Showing 2 changed files with 147 additions and 1 deletion.
143 changes: 143 additions & 0 deletions app-i18n/freewnn/files/freewnn-Wformat-security.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
--- a/Wnn/uum/jhlp.c
+++ b/Wnn/uum/jhlp.c
@@ -1135,7 +1135,7 @@
else
{
signal (SIGCHLD, SIG_IGN);
- printf (MSG_GET (3));
+ printf ("%s", MSG_GET (3));
/*
printf("\r\nuumを終わります。\r\n");
*/
@@ -1212,8 +1212,8 @@

if ((buf = (unsigned char *) malloc (maxchg * 4)) == NULL)
{
- printf (MSG_GET (2));
- printf (MSG_GET (3));
+ printf ("%s", MSG_GET (2));
+ printf ("%s", MSG_GET (3));
/*
printf("malloc に失敗しました。uumを終わります。\r\n");
*/
--- a/Wnn/uum/jis_in.c
+++ b/Wnn/uum/jis_in.c
@@ -64,7 +64,7 @@

completely_start:
throw_c (0); /* モード表示の後に出す */
- printf (MSG_GET (6));
+ printf ("%s", MSG_GET (6));
/*
printf("JISコード: ");
*/
--- a/Wnn/uum/jutil.c
+++ b/Wnn/uum/jutil.c
@@ -489,7 +489,7 @@
/*
printf("只今、辞書を読み込んでいます。");
*/
- printf (MSG_GET (60));
+ printf ("%s", MSG_GET (60));
flush ();

if ((id = jl_dic_add (bun_data_, fname, hfname, 0, prio, rdonly, hrdonly, NULL, NULL, yes_or_no_or_newline, print_msg1)) == -1 && wnn_errorno != -1)
@@ -571,7 +571,7 @@
int x;
throw_c (0);
clr_line ();
- printf (string);
+ printf ("%s", string);
flush ();
for (;;)
{
--- a/Wnn/uum/kensaku.c
+++ b/Wnn/uum/kensaku.c
@@ -112,7 +112,7 @@
u_s_on ();
w_printf (kana_buf, maxlength - strlen (MSG_GET (27)) - 2);
u_s_off ();
- printf (MSG_GET (27));
+ printf ("%s", MSG_GET (27));
flush ();
keyin ();
return (NULL);
--- a/Wnn/uum/kuten.c
+++ b/Wnn/uum/kuten.c
@@ -63,7 +63,7 @@

completely_start:
throw_c (0); /* モード表示の後に出す */
- printf (MSG_GET (7));
+ printf ("%s", MSG_GET (7));
/*
printf("区点 : ");
*/
--- a/Wnn/uum/prologue.c
+++ b/Wnn/uum/prologue.c
@@ -144,7 +144,7 @@
/*
fprintf(stderr,"初期化でmalloc不能。\n");
*/
- fprintf (stderr, MSG_GET (2));
+ fprintf (stderr, "%s", MSG_GET (2));
return (-1);
}

--- a/Wnn/uum/screen.c
+++ b/Wnn/uum/screen.c
@@ -547,7 +547,7 @@
{
push_cursor ();
throw_c (0);
- printf (msg);
+ printf ("%s", msg);
pop_cursor ();
flush ();
}
--- a/Wnn/uum/sdefine.h
+++ b/Wnn/uum/sdefine.h
@@ -191,8 +191,8 @@


#define flush() fflush(stdout)
-#define print_msg(X) {push_cursor();throw_c(0); clr_line();printf(X);flush();pop_cursor();}
-#define print_msg_getc(X) {push_cursor();throw_c(0); clr_line();printf(X);flush();keyin();pop_cursor();}
+#define print_msg(X) {push_cursor();throw_c(0); clr_line();printf("%s", X);flush();pop_cursor();}
+#define print_msg_getc(X) {push_cursor();throw_c(0); clr_line();printf("%s", X);flush();keyin();pop_cursor();}


#define UNDER_LINE_MODE (0x02 | 0x08 | 0x20)
--- a/Wnn/uum/select_ele.c
+++ b/Wnn/uum/select_ele.c
@@ -224,7 +224,7 @@

throw_c (0);
clr_line ();
- printf (msg);
+ printf ("%s", msg);
for (k = dd[cc]; k < dd[cc + 1]; k++)
{
cp = findcp (k, cc);
--- a/Wnn/uum/termio.c
+++ b/Wnn/uum/termio.c
@@ -100,7 +100,7 @@

if ((strlen (Term_Name) > 2) && (strcmp (Term_Name + (strlen (Term_Name) - 2), "-j") == 0))
{
- fprintf (stderr, MSG_GET (4));
+ fprintf (stderr, "%s", MSG_GET (4));
/*
fprintf(stderr,"Uum:uumからuumはおこせません。\n");
*/
--- a/Wnn/uum/wnnrc_op.c
+++ b/Wnn/uum/wnnrc_op.c
@@ -754,7 +754,7 @@
return fp;
}
error:
- fprintf (stderr, MSG_GET (14));
+ fprintf (stderr, "%s", MSG_GET (14));
/*
fprintf(stderr , "uumrc ファイルがありません。");
*/
5 changes: 4 additions & 1 deletion app-i18n/freewnn/freewnn-1.1.1_alpha22.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ IUSE="ipv6"

S="${WORKDIR}/${MY_P}"

PATCHES=( "${FILESDIR}"/${P}-parallel-build.patch )
PATCHES=(
"${FILESDIR}"/${P}-parallel-build.patch
"${FILESDIR}"/${PN}-Wformat-security.patch
)
DOCS="ChangeLog* CONTRIBUTORS"

src_prepare() {
Expand Down

0 comments on commit 4df816e

Please sign in to comment.