Skip to content

Conversation

BlackIkeEagle
Copy link
Contributor

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.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.

Signed-off-by: BlackEagle <ike.devolder@gmail.com>
@Atoptool Atoptool merged commit 13a4178 into Atoptool:master Jun 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants