When building with -Werror=format-security there are some issues with the use of mvwprintw in drawbar.c
export CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions \
-Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security \
-fstack-clash-protection -fcf-protection"
make
...
cc -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -O2 -I. -Wall -Wno-stringop-truncation -Wmissing-prototypes -Wmissing-declarations -c -o drawbar.o drawbar.c
drawbar.c: In function ‘drawevent’:
drawbar.c:2058:9: error: format not a string literal and no format arguments [-Werror=format-security]
2058 | mvwprintw(w->win, line, column, text);
| ^~~~~~~~~
drawbar.c: In function ‘headergetch’:
drawbar.c:2108:17: error: format not a string literal and no format arguments [-Werror=format-security]
2108 | mvwprintw(headwin, 0, statcol, statusmsg);
| ^~~~~~~~~
drawbar.c: In function ‘getwininput’:
drawbar.c:2331:9: error: format not a string literal and no format arguments [-Werror=format-security]
2331 | mvwprintw(mywin, 1, 1, prompt);
| ^~~~~~~~~
cc1: some warnings being treated as errors
make: *** [<builtin>: drawbar.o] Error 1
By explicitly adding the format "%s" this error is fixed.
When building with
-Werror=format-security
there are some issues with the use of mvwprintw in drawbar.cBy explicitly adding the format
"%s"
this error is fixed.