From 7247360e2972798cd525b8a9493ab4f15c546712 Mon Sep 17 00:00:00 2001 From: Robinhuett <5955614+Robinhuett@users.noreply.github.com> Date: Mon, 25 Feb 2019 18:28:56 +0100 Subject: [PATCH] fix: Escape user controlled input --- src/modules/custom.cpp | 4 ++-- src/modules/sway/mode.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/custom.cpp b/src/modules/custom.cpp index 978602c8..18491afa 100644 --- a/src/modules/custom.cpp +++ b/src/modules/custom.cpp @@ -123,7 +123,7 @@ void waybar::modules::Custom::parseOutputRaw() int i = 0; while (getline(output, line)) { if (i == 0) { - text_ = line; + text_ = Glib::Markup::escape_text(line); tooltip_ = line; class_ = ""; } else if (i == 1) { @@ -143,7 +143,7 @@ void waybar::modules::Custom::parseOutputJson() std::string line; while (getline(output, line)) { auto parsed = parser_.parse(line); - text_ = parsed["text"].asString(); + text_ = Glib::Markup::escape_text(parsed["text"].asString()); tooltip_ = parsed["tooltip"].asString(); class_ = parsed["class"].asString(); if (!parsed["percentage"].asString().empty() && parsed["percentage"].isUInt()) { diff --git a/src/modules/sway/mode.cpp b/src/modules/sway/mode.cpp index c4b47350..a2da0782 100644 --- a/src/modules/sway/mode.cpp +++ b/src/modules/sway/mode.cpp @@ -20,7 +20,7 @@ void waybar::modules::sway::Mode::worker() auto res = ipc_.handleEvent(); auto parsed = parser_.parse(res.payload); if (parsed["change"] != "default") { - mode_ = parsed["change"].asString(); + mode_ = Glib::Markup::escape_text(parsed["change"].asString()); } else { mode_.clear(); }