Skip to content

Commit 4ab567f

Browse files
authored
Add -Wformat-security to build (#53546)
This enhances some printing security: > At present, this warns about calls to printf and scanf functions where > the format string is not a string literal and there are no format arguments, > as in printf (foo);. This may be a security hole if the format string came > from untrusted input and contains ‘%n’. (This is currently a subset of what > -Wformat-nonliteral warns about, but in future warnings may be added to > -Wformat-security that are not included in -Wformat-nonliteral.)
1 parent 157d4ee commit 4ab567f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Make.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ MACOSX_VERSION_MIN := 11.0
495495
endif
496496
endif
497497

498-
JCFLAGS_COMMON := -std=gnu11 -pipe $(fPIC) -fno-strict-aliasing -D_FILE_OFFSET_BITS=64
498+
JCFLAGS_COMMON := -std=gnu11 -pipe $(fPIC) -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -Wformat -Wformat-security
499499
JCFLAGS_CLANG := $(JCFLAGS_COMMON)
500500
JCFLAGS_GCC := $(JCFLAGS_COMMON) -fno-gnu-unique
501501

@@ -504,7 +504,7 @@ JCPPFLAGS_COMMON := -fasynchronous-unwind-tables
504504
JCPPFLAGS_CLANG := $(JCPPFLAGS_COMMON) -mllvm -enable-tail-merge=0
505505
JCPPFLAGS_GCC := $(JCPPFLAGS_COMMON) -fno-tree-tail-merge
506506

507-
JCXXFLAGS_COMMON := -pipe $(fPIC) -fno-rtti -std=c++17
507+
JCXXFLAGS_COMMON := -pipe $(fPIC) -fno-rtti -std=c++17 -Wformat -Wformat-security
508508
JCXXFLAGS_CLANG := $(JCXXFLAGS_COMMON) -pedantic
509509
JCXXFLAGS_GCC := $(JCXXFLAGS_COMMON) -fno-gnu-unique
510510

0 commit comments

Comments
 (0)