From 41e93adbdbd56db065166af5a6676a7996e9e451 Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Thu, 4 Nov 2021 09:44:33 +0000 Subject: [PATCH] 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. --- src/game_chess.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/game_chess.c b/src/game_chess.c index 9a11382..b83a36b 100644 --- a/src/game_chess.c +++ b/src/game_chess.c @@ -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);