From 22025c2f0d13e4a4179cc7bc88a854fc4ab2105e Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Tue, 25 Jul 2023 15:56:22 -0400 Subject: fix regex reading from freed memory (fixes #197) --- src/components/chatmessage.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/components/chatmessage.cpp') diff --git a/src/components/chatmessage.cpp b/src/components/chatmessage.cpp index 23ee36f..d1d9f72 100644 --- a/src/components/chatmessage.cpp +++ b/src/components/chatmessage.cpp @@ -204,7 +204,8 @@ void ChatMessageItemContainer::UpdateTextComponent(Gtk::TextView *tv) { if (data->Application.has_value()) { static const auto regex = Glib::Regex::create(R"()"); Glib::MatchInfo match; - if (regex->match(data->Content, match)) { + Glib::ustring string = data->Content; + if (regex->match(string, match)) { const auto cmd = match.fetch(1); const auto app = data->Application->Name; b->insert_markup(s, "used " + cmd + " with " + app + ""); -- cgit v1.2.3