From 358426cb1ce7a13e782dc56e96263660f8ee3da8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Venri=C3=A8s?= Date: Wed, 16 Oct 2019 19:37:12 +0200 Subject: [PATCH] fix: No need to format string with unused 'arg' named argument (#484) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The fmt::format() function looks for the "{arg}" named argument in the given "format" string which does not exist. It will fail if the string contains any {...} curled-brace substring. Consequently, any "on-click*" option's command line containing for instance substring like "${var}" or "awk '{...}'" will crash the program. Signed-off-by: Thomas Venriès --- include/AModule.hpp | 1 - src/AModule.cpp | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/include/AModule.hpp b/include/AModule.hpp index 841b8d6e..f7cc484e 100644 --- a/include/AModule.hpp +++ b/include/AModule.hpp @@ -26,7 +26,6 @@ class AModule : public IModule { const Json::Value &config_; Gtk::EventBox event_box_; - std::string click_param_; virtual bool handleToggle(GdkEventButton *const &ev); virtual bool handleScroll(GdkEventScroll *); diff --git a/src/AModule.cpp b/src/AModule.cpp index 38e97850..354d1bf9 100644 --- a/src/AModule.cpp +++ b/src/AModule.cpp @@ -46,7 +46,7 @@ bool AModule::handleToggle(GdkEventButton* const& e) { format = config_["on-click-forward"].asString(); } if (!format.empty()) { - pid_.push_back(util::command::forkExec(fmt::format(format, fmt::arg("arg", click_param_)))); + pid_.push_back(util::command::forkExec(format)); } dp.emit(); return true;