Skip to content

Commit 801fa63

Browse files
peffgitster
authored andcommitted
config.mak.dev: add -Wformat-security
We currently build cleanly with -Wformat-security, and it's a good idea to make sure we continue to do so (since calls that trigger the warning may be security vulnerabilities). Note that we cannot use the stronger -Wformat-nonliteral, as there are case where we are clever with passing around pointers to string literals. E.g., bisect_rev_setup() takes bad_format and good_format parameters. These ultimately come from literals, but they still trigger the warning. Some of these might be fixable (e.g., by passing flags from which we locally select a format), and might even be worth fixing (not because of security, but just because it's an easy mistake to pass the wrong format). But there are other cases which are likely quite hard to fix (we actually generate formats in a local buffer in some cases). So let's punt on that for now and start with -Wformat-security, which is supposed to catch the most important cases. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 53f9a3e commit 801fa63

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

config.mak.dev

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ ifeq ($(filter no-error,$(DEVOPTS)),)
22
CFLAGS += -Werror
33
endif
44
CFLAGS += -Wdeclaration-after-statement
5+
CFLAGS += -Wformat-security
56
CFLAGS += -Wno-format-zero-length
67
CFLAGS += -Wold-style-definition
78
CFLAGS += -Woverflow

0 commit comments

Comments
 (0)