Blame SOURCES/0002-Makefile-add-Werror-format-security.patch

c2c72f
From 202b2e7b27a159d54a525b0cfd366b8d52d5a3a1 Mon Sep 17 00:00:00 2001
c2c72f
Message-Id: <202b2e7b27a159d54a525b0cfd366b8d52d5a3a1.1386069831.git.npajkovs@redhat.com>
c2c72f
From: Nikola Pajkovsky <npajkovs@redhat.com>
c2c72f
Date: Tue, 3 Dec 2013 12:12:16 +0100
c2c72f
Subject: [PATCH] Makefile: add -Werror=format-security
c2c72f
MIME-Version: 1.0
c2c72f
Content-Type: text/plain; charset=UTF-8
c2c72f
Content-Transfer-Encoding: 8bit
c2c72f
c2c72f
-Wformat-security
c2c72f
        If -Wformat is specified, also warn about uses of format
c2c72f
        functions that represent possible security problems. At
c2c72f
        present, this warns about calls to printf and scanf functions
c2c72f
        where the format string is not a string literal and there are
c2c72f
        no format arguments, as in printf (foo);. This may be a
c2c72f
        security hole if the format string came from untrusted input
c2c72f
        and contains ā€˜%nā€™. (This is currently a subset of what
c2c72f
        -Wformat-nonliteral warns about, but in future warnings may be
c2c72f
        added to -Wformat-security that are not included in
c2c72f
        -Wformat-nonliteral.)
c2c72f
c2c72f
Signed-off-by: Nikola Pajkovsky <npajkovs@redhat.com>
c2c72f
---
c2c72f
 Makefile       | 2 +-
c2c72f
 src/ipfilter.c | 2 +-
c2c72f
 src/othptab.c  | 4 ++--
c2c72f
 3 files changed, 4 insertions(+), 4 deletions(-)
c2c72f
c2c72f
diff --git a/Makefile b/Makefile
c2c72f
index 46e5632e3287..958b0fbeec0f 100644
c2c72f
--- a/Makefile
c2c72f
+++ b/Makefile
c2c72f
@@ -18,7 +18,7 @@ VERSION-FILE: FORCE
c2c72f
 	@$(SHELL_PATH) ./GEN-VERSION-FILE
c2c72f
 -include VERSION-FILE
c2c72f
 
c2c72f
-CFLAGS = -g -O2 -Wall -W -std=gnu99
c2c72f
+CFLAGS = -g -O2 -Wall -W -std=gnu99 -Werror=format-security
c2c72f
 LDFLAGS =
c2c72f
 ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS)
c2c72f
 ALL_LDFLAGS = $(LDFLAGS)
c2c72f
diff --git a/src/ipfilter.c b/src/ipfilter.c
c2c72f
index eb17ec7c7615..8c76e4c801c2 100644
c2c72f
--- a/src/ipfilter.c
c2c72f
+++ b/src/ipfilter.c
c2c72f
@@ -146,7 +146,7 @@ void gethostparams(struct hostparams *data, char *init_saddr, char *init_smask,
c2c72f
 				snprintf(msgstr, 60,
c2c72f
 					 "Invalid protocol input at or near token \"%s\"",
c2c72f
 					 bptr);
c2c72f
-				tui_error(ANYKEY_MSG, msgstr);
c2c72f
+				tui_error(ANYKEY_MSG, "%s", msgstr);
c2c72f
 				doagain = 1;
c2c72f
 			} else
c2c72f
 				doagain = 0;
c2c72f
diff --git a/src/othptab.c b/src/othptab.c
c2c72f
index 5c09241fca99..e23f39e5df45 100644
c2c72f
--- a/src/othptab.c
c2c72f
+++ b/src/othptab.c
c2c72f
@@ -407,7 +407,7 @@ void printothpentry(struct othptable *table, struct othptabent *entry,
c2c72f
 				break;
c2c72f
 			}
c2c72f
 
c2c72f
-			sprintf(scratchpad, rarp_mac_addr);
c2c72f
+			sprintf(scratchpad, "%s", rarp_mac_addr);
c2c72f
 			strcat(msgstring, scratchpad);
c2c72f
 			wattrset(table->othpwin, ARPATTR);
c2c72f
 			break;
c2c72f
@@ -482,7 +482,7 @@ void printothpentry(struct othptable *table, struct othptabent *entry,
c2c72f
 		wattrset(table->othpwin, UNKNIPATTR);
c2c72f
 		protptr = getprotobynumber(entry->protocol);
c2c72f
 		if (protptr != NULL) {
c2c72f
-			sprintf(protname, protptr->p_aliases[0]);
c2c72f
+			sprintf(protname, "%s", protptr->p_aliases[0]);
c2c72f
 		} else {
c2c72f
 			sprintf(protname, "IP protocol");
c2c72f
 			unknown = 1;
c2c72f
-- 
c2c72f
1.8.3.2
c2c72f