FTBFS if "-Werror=format-security" flag is used

Kevin Kofler kevin.kofler at chello.at
Tue Dec 10 14:50:38 UTC 2013


drago01 wrote:

> On Tue, Dec 10, 2013 at 3:00 AM, Kevin Kofler <kevin.kofler at chello.at>
> wrote:
>> [...] and removes functionality
> 
> No it does not.

Yes, it does, see my example:
| a printf wrapper for logging which adds a timestamp in front of the
| format string, e.g.
| log("processed %d items", foo);
| which would be printed as
| 2013-12-06 19:00:00: processed 123 items
| to some logfile (using vfprintf with a format string like
| "2013-12-06 19:00:00: processed %d items"
| concatenated at runtime).

-Werror=format-security removes the functionality of building format strings 
at runtime, and there are legitimate uses for such functionality.

And it has been mentioned elsewhere in this thread that GCC doesn't even 
recognize cases where the format string is constant, but not a string 
literal, where it is picked from a list of constant formats, etc.

        Kevin Kofler



More information about the devel mailing list