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

Stefan Lippers-Hollmann s.l-h at gmx.de
Fri Dec 12 23:00:10 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 irsimsend.o irsimsend.c
irsimsend.c: In function 'parse_uint_arg':
irsimsend.c:199:3: error: format not a string literal and no format arguments [-Werror=format-security]
   fprintf(stderr, errmsg);
   ^
irsimsend.c: In function 'main':
irsimsend.c:216:4: error: format not a string literal and no format arguments [-Werror=format-security]
    printf(USAGE);
    ^
irsimsend.c:246:3: error: format not a string literal and no format arguments [-Werror=format-security]
   fprintf(stderr, USAGE);
   ^

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

diff --git a/tools/irsimsend.c b/tools/irsimsend.c
index b72831a..e8dcd07 100644
--- a/tools/irsimsend.c
+++ b/tools/irsimsend.c
@@ -196,7 +196,7 @@ int parse_uint_arg(const char* optind, const char* errmsg)
 
 	c = strtol(optarg, NULL, 10);
 	if (c > INT_MAX || c < 0 || errno == EINVAL || errno == ERANGE) {
-		fprintf(stderr, errmsg);
+		fprintf(stderr, "%s", errmsg);
 		exit(EXIT_FAILURE);
 	}
 	return (int) c;
@@ -213,7 +213,7 @@ int main(int argc, char *argv[])
 	       != EOF) {
 		switch (c) {
 		case 'h':
-			printf(USAGE);
+			printf("%s", USAGE);
 			return (EXIT_SUCCESS);
 		case 'c':
 			opt_count = parse_uint_arg(optarg,
@@ -243,7 +243,7 @@ int main(int argc, char *argv[])
 		}
 	}
 	if (argc != optind + 1) {
-		fprintf(stderr, USAGE);
+		fprintf(stderr, "%s", USAGE);
 		return EXIT_FAILURE;
 	}
 	lirc_log_get_clientlog("irsimsend", path, sizeof(path));
-- 
2.1.3




More information about the Pkg-lirc-maint mailing list