From 30ee4cde52fb976732cc6311671c43d10277f910 Mon Sep 17 00:00:00 2001 From: Paul Wise Date: Thu, 25 Nov 2021 12:46:36 +0800 Subject: [PATCH] Format strings: use %s when printing strings Otherwise the string itself could be interpreted as a format string. Suggested-by: g++ --- main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.cpp b/main.cpp index 7dcdf05..7d8b42c 100644 --- a/main.cpp +++ b/main.cpp @@ -214,7 +214,7 @@ void drawVersion(WINDOW * window) auto title = " " + TITLE + "-" + VERSION + " "; wattrset(window, COLOR_PAIR(TITLE_COLOR)); - mvwprintw(window, 0, (width - title.length()) / 2, title.c_str()); + mvwprintw(window, 0, (width - title.length()) / 2, "%s", title.c_str()); wattroff(window, COLOR_PAIR(TITLE_COLOR)); wnoutrefresh(window); @@ -247,7 +247,7 @@ void drawDeviceBar(WINDOW * window, std::vector const & smartList, int se if (i == select) { wattrset(window, COLOR_PAIR(HEALTH_COLOR) | A_BOLD); - mvwprintw(window, 2, x, smartList[i].deviceName.c_str()); + mvwprintw(window, 2, x, "%s", smartList[i].deviceName.c_str()); wattroff(window, COLOR_PAIR(HEALTH_COLOR) | A_BOLD); wattrset(window, COLOR_PAIR(HEALTH_COLOR)); @@ -256,7 +256,7 @@ void drawDeviceBar(WINDOW * window, std::vector const & smartList, int se } else { - mvwprintw(window, 2, x, smartList[i].deviceName.c_str()); + mvwprintw(window, 2, x, "%s", smartList[i].deviceName.c_str()); mvwhline(window, 3, x, ' ', smartList[i].deviceName.length()); } x += smartList[i].deviceName.length() + 1;