[Pkg-lirc-maint] [PATCH 06/13] irtestcase: fix FTBS with -Werror=format-security enabled

Stefan Lippers-Hollmann s.l-h at gmx.de
Fri Dec 12 23:00:09 UTC 2014


gcc -DHAVE_CONFIG_H -I. -I..  -I../lib -I..  -g -Wall -Wp,-D_FORTIFY_SOURCE=2 -D_FORTIFY_SOURCE=2  -g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security  -c -o irtestcase.o irtestcase.c
irtestcase.c: In function 'irtestcase':
irtestcase.c:184:3: error: format not a string literal and no format arguments [-Werror=format-security]
   printf(code);
   ^
irtestcase.c:188:3: error: format not a string literal and no format arguments [-Werror=format-security]
   fprintf(code_log, code);
   ^
irtestcase.c: In function 'main':
irtestcase.c:225:4: error: format not a string literal and no format arguments [-Werror=format-security]
    printf(USAGE);
    ^

Signed-off-by: Stefan Lippers-Hollmann <s.l-h at gmx.de>
---
 tools/irtestcase.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/irtestcase.c b/tools/irtestcase.c
index 95d59b7..5223737 100644
--- a/tools/irtestcase.c
+++ b/tools/irtestcase.c
@@ -181,11 +181,11 @@ static int irtestcase(int fd_io, int fd_cmd)
 		}
 	}
 	while (nextcode(fd_io, code, sizeof(code)) == 1) {
-		printf(code);
+		printf("%s", code);
 		if (strstr(code, "__EOF") != NULL) {
 			exit(0);
 		}
-		fprintf(code_log, code);
+		fprintf(code_log, "%s", code);
 		if (opt_lircrc != NULL){
 			r = lirc_code2char(config, code, &c);
 			while (r == 0 && c != NULL) {
@@ -222,7 +222,7 @@ int main(int argc, char *argv[])
 			opt_testdata = optarg;
 			break;
 		case 'h':
-			printf(USAGE);
+			printf("%s", USAGE);
 			return (EXIT_SUCCESS);
 		case 'v':
 			printf("%s\n", "irtestcase " VERSION);
-- 
2.1.3




More information about the Pkg-lirc-maint mailing list