patches/gcc/4.4.4/140-default-format-security.patch
changeset 1953 a93af06e180d
child 2148 ada9128c98b8
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/gcc/4.4.4/140-default-format-security.patch	Sun May 16 19:41:53 2010 +0200
     1.3 @@ -0,0 +1,51 @@
     1.4 +diff -durN gcc-4.4.0.orig/gcc/c-common.c gcc-4.4.0/gcc/c-common.c
     1.5 +
     1.6 +diff -durN gcc-4.4.4.orig/gcc/c-common.c gcc-4.4.4/gcc/c-common.c
     1.7 +--- gcc-4.4.4.orig/gcc/c-common.c	2009-11-05 15:57:57.000000000 +0100
     1.8 ++++ gcc-4.4.4/gcc/c-common.c	2010-05-16 19:11:21.000000000 +0200
     1.9 +@@ -301,7 +301,7 @@
    1.10 + /* Warn about format/argument anomalies in calls to formatted I/O functions
    1.11 +    (*printf, *scanf, strftime, strfmon, etc.).  */
    1.12 + 
    1.13 +-int warn_format;
    1.14 ++int warn_format = 1;
    1.15 + 
    1.16 + /* Warn about using __null (as NULL in C++) as sentinel.  For code compiled
    1.17 +    with GCC this doesn't matter as __null is guaranteed to have the right
    1.18 +diff -durN gcc-4.4.4.orig/gcc/c.opt gcc-4.4.4/gcc/c.opt
    1.19 +--- gcc-4.4.4.orig/gcc/c.opt	2009-09-18 23:53:23.000000000 +0200
    1.20 ++++ gcc-4.4.4/gcc/c.opt	2010-05-16 19:11:21.000000000 +0200
    1.21 +@@ -236,7 +236,7 @@
    1.22 + Warn about format strings that contain NUL bytes
    1.23 + 
    1.24 + Wformat-security
    1.25 +-C ObjC C++ ObjC++ Var(warn_format_security) Warning
    1.26 ++C ObjC C++ ObjC++ Var(warn_format_security) Init(1) Warning
    1.27 + Warn about possible security problems with format functions
    1.28 + 
    1.29 + Wformat-y2k
    1.30 +diff -durN gcc-4.4.4.orig/gcc/doc/invoke.texi gcc-4.4.4/gcc/doc/invoke.texi
    1.31 +--- gcc-4.4.4.orig/gcc/doc/invoke.texi	2010-04-08 12:46:46.000000000 +0200
    1.32 ++++ gcc-4.4.4/gcc/doc/invoke.texi	2010-05-16 19:11:21.000000000 +0200
    1.33 +@@ -2888,6 +2888,9 @@
    1.34 + @option{-Wformat-nonliteral}, @option{-Wformat-security}, and
    1.35 + @option{-Wformat=2} are available, but are not included in @option{-Wall}.
    1.36 + 
    1.37 ++NOTE: In Gentoo, this option is enabled by default for C, C++, ObjC, ObjC++.
    1.38 ++To disable, use @option{-Wformat=0}.
    1.39 ++
    1.40 + @item -Wformat-y2k
    1.41 + @opindex Wformat-y2k
    1.42 + @opindex Wno-format-y2k
    1.43 +@@ -2941,6 +2944,11 @@
    1.44 + in future warnings may be added to @option{-Wformat-security} that are not
    1.45 + included in @option{-Wformat-nonliteral}.)
    1.46 + 
    1.47 ++NOTE: In Gentoo, this option is enabled by default for C, C++, ObjC, ObjC++.
    1.48 ++To disable, use @option{-Wno-format-security}, or disable all format warnings
    1.49 ++with @option{-Wformat=0}.  To make format security warnings fatal, specify
    1.50 ++@option{-Werror=format-security}.
    1.51 ++
    1.52 + @item -Wformat=2
    1.53 + @opindex Wformat=2
    1.54 + @opindex Wno-format=2