------- Comment #5 from jakub at gcc dot gnu dot org  2007-11-29 11:25 -------
It is invalid for -D_FORTIFY_SOURCE=2.
-D_FORTIFY_SOURCE=1 allows all standard conforming code, -D_FORTIFY_SOURCE=2
imposes further restrictions (one is e.g. that %n for *printf arguments must be
only used in strings which can't be written into, one is that the str*/stp*
family of functions not only can't overflow into some other object, but can't
overflow from one struct field into another, etc.).

So, either rewrite the code using mem* functions (which even with
-D_FORTIFY_SOURCE=2 can cross field boundaries), or rewrite it to initialize
the fields individually, not in one call, or use -D_FORTIFY_SOURCE=1 instead of
-D_FORTIFY_SOURCE=2.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34285

Reply via email to