mirror of
https://github.com/Tha14/toxic.git
synced 2024-12-23 03:53:25 +01:00
game_chess.c: always use "%s"-style format for printf()-style functions
`ncuses-6.3` added printf-style function attributes and now makes it easier to catch cases when user input is used in palce of format string when built with CFLAGS=-Werror=format-security: toxic/src/game_chess.c:1633:63: error: format not a string literal and no format arguments [-Werror=format-security] 1633 | mvwprintw(win, board->y_bottom_bound + 2, x_mid, state->status_message); | ~~~~~^~~~~~~~~~~~~~~~ Let's wrap all the missing places with "%s" format.
This commit is contained in:
parent
34b7c0a0d8
commit
41e93adbdb
@ -1626,11 +1626,11 @@ static void chess_print_status(WINDOW *win, ChessState *state)
|
||||
}
|
||||
|
||||
int x_mid = (board->x_left_bound + (CHESS_TILE_SIZE_X * (CHESS_BOARD_COLUMNS / 2))) - (strlen(message) / 2);
|
||||
mvwprintw(win, board->y_top_bound - 2, x_mid, message);
|
||||
mvwprintw(win, board->y_top_bound - 2, x_mid, "%s", message);
|
||||
|
||||
if (state->message_length > 0) {
|
||||
x_mid = (board->x_left_bound + (CHESS_TILE_SIZE_X * (CHESS_BOARD_COLUMNS / 2))) - (state->message_length / 2);
|
||||
mvwprintw(win, board->y_bottom_bound + 2, x_mid, state->status_message);
|
||||
mvwprintw(win, board->y_bottom_bound + 2, x_mid, "%s", state->status_message);
|
||||
}
|
||||
|
||||
wattroff(win, A_BOLD);
|
||||
|
Loading…
Reference in New Issue
Block a user