On Debian and Ubuntu the following hardening flags are used:
(see dpkg-buildflags --export=sh)
export CFLAGS="-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security"
export CPPFLAGS="-D_FORTIFY_SOURCE=2"
export CXXFLAGS="-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security"
export FFLAGS="-g -O2"
export LDFLAGS="-Wl,-z,relro"
Without this commit the following error occurs:
dvb-fe.c:56:3: error: format not a string literal and no format arguments [-Werror=format-security]
dvb-fe.c:61:3: error: format not a string literal and no format arguments [-Werror=format-security]
Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
if(STDERR_FILENO == loglevels[level].fd)
out = stderr;
if(isatty(loglevels[level].fd))
- fprintf(out, loglevels[level].color);
+ fputs(loglevels[level].color, out);
fprintf(out, "%s ", loglevels[level].name);
vfprintf(out, fmt, ap);
fprintf(out, "\n");
if(isatty(loglevels[level].fd))
- fprintf(out, loglevels[LOG_COLOROFF].color);
+ fputs(loglevels[LOG_COLOROFF].color, out);
va_end(ap);
}