[OpenWrt-Devel] [RFC 1/3] Introduce PKG_CHECK_FORMAT_SECURITY

Etienne CHAMPETIER etienne.champetier at free.fr
Mon Jun 23 17:39:21 EDT 2014


The idea is to get rid of
http://en.wikipedia.org/wiki/Uncontrolled_format_string
by using "-Wformat -Werror=format-security" by default

Signed-off-by: Etienne CHAMPETIER <etienne.champetier at free.fr>
---
 include/package.mk |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/include/package.mk b/include/package.mk
index f7da9e3..7d75f08 100644
--- a/include/package.mk
+++ b/include/package.mk
@@ -14,6 +14,7 @@ PKG_INSTALL_DIR ?= $(PKG_BUILD_DIR)/ipkg-install
 PKG_MD5SUM ?= unknown
 PKG_BUILD_PARALLEL ?=
 PKG_USE_MIPS16 ?= 1
+PKG_CHECK_FORMAT_SECURITY ?= 1
 
 ifneq ($(CONFIG_PKG_BUILD_USE_JOBSERVER),)
   MAKE_J:=$(if $(MAKE_JOBSERVER),$(MAKE_JOBSERVER) -j)
@@ -33,6 +34,9 @@ ifdef CONFIG_USE_MIPS16
     TARGET_CFLAGS += -mips16 -minterlink-mips16
   endif
 endif
+ifeq ($(strip $(PKG_CHECK_FORMAT_SECURITY)),1)
+  TARGET_CFLAGS += -Wformat -Werror=format-security
+endif
 
 include $(INCLUDE_DIR)/prereq.mk
 include $(INCLUDE_DIR)/host.mk
-- 
1.7.1
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list