From 54a6d127351ea2c62f50efafe97c5b02e23e86a7 Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Wed, 3 Nov 2021 08:05:23 +0000 Subject: [PATCH] Ui.cpp: 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: Ui.cpp:293:16: error: format not a string literal and no format arguments [-Werror=format-security] 293 | mvwprintw(w,0,0,msg.c_str()); | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~ Let's wrap all the missing places with "%s" format. --- Ui.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Ui.cpp b/Ui.cpp index 867f33a..3ea479f 100644 --- a/Ui.cpp +++ b/Ui.cpp @@ -183,7 +183,7 @@ namespace Bastet{ BorderedWindow w(d.y,d.x); wattrset((WINDOW *)w,COLOR_PAIR(20)); - mvwprintw(w,0,0,message.c_str()); + mvwprintw(w,0,0,"%s",message.c_str()); w.RedrawBorder(); wrefresh(w); PrepareUiGetch(); @@ -200,7 +200,7 @@ namespace Bastet{ d.y+=3; BorderedWindow w(d.y,d.x); wattrset((WINDOW *)w,COLOR_PAIR(20)); - mvwprintw(w,0,0,message.c_str()); + mvwprintw(w,0,0,"%s",message.c_str()); w.RedrawBorder(); wrefresh(w); PrepareUiGetch(); @@ -221,7 +221,7 @@ namespace Bastet{ BorderedWindow w(d.y,d.x); wattrset((WINDOW *)w,COLOR_PAIR(20)); - mvwprintw(w,0,0,message.c_str()); + mvwprintw(w,0,0,"%s",message.c_str()); w.RedrawBorder(); wrefresh(w); PrepareUiGetch(); @@ -239,7 +239,7 @@ namespace Bastet{ BorderedWindow w(d.y,d.x); wattrset((WINDOW *)w,COLOR_PAIR(20)); for(size_t i=0;i