ngscopeclient / scopehal-apps

ngscopeclient and other client applications for libscopehal.
https://www.ngscopeclient.org/
BSD 3-Clause "New" or "Revised" License
549 stars 84 forks source link

build fails with `-Werror=format-security` #571

Closed ensc closed 1 year ago

ensc commented 1 year ago

https://github.com/glscopeclient/scopehal-apps/blob/b86e70d15fb46cc2a170486845c4fd2dfee30b05/src/ngscopeclient/Dialog.cpp#L210 causes

.../src/ngscopeclient/Dialog.cpp: In static member function 'static void Dialog::HelpMarker(const std::string&, const std::vector<std::__cxx11::basic_string<char> >&)':
../src/ngscopeclient/Dialog.cpp:210:42: error: format not a string literal and no format arguments [-Werror=format-security]
  210 |                         ImGui::BulletText(s.c_str());
      |                         ~~~~~~~~~~~~~~~~~^~~~~~~~~~~
cc1plus: some warnings being treated as errors

Fix should be trivial

--- scopehal-apps-0.0.1.orig/src/ngscopeclient/Dialog.cpp
+++ scopehal-apps-0.0.1/src/ngscopeclient/Dialog.cpp
@@ -207,7 +207,7 @@ void Dialog::HelpMarker(const string& he
        ImGui::PushTextWrapPos(ImGui::GetFontSize() * 50);
        ImGui::TextUnformatted(header.c_str());
        for(auto s : bullets)
-           ImGui::BulletText(s.c_str());
+           ImGui::BulletText("%s", s.c_str());
        ImGui::PopTextWrapPos();
        ImGui::EndTooltip();
    }