diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2023-07-25 15:56:22 -0400 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2023-07-25 15:56:22 -0400 |
commit | 22025c2f0d13e4a4179cc7bc88a854fc4ab2105e (patch) | |
tree | ca34c199dfd8f61eb5a9b2938fc3cb173bb16ca6 /src | |
parent | 857e94af3817932b78963873fb5621ae3c4596f7 (diff) | |
download | abaddon-portaudio-22025c2f0d13e4a4179cc7bc88a854fc4ab2105e.tar.gz abaddon-portaudio-22025c2f0d13e4a4179cc7bc88a854fc4ab2105e.zip |
fix regex reading from freed memory (fixes #197)
Diffstat (limited to 'src')
-rw-r--r-- | src/components/chatmessage.cpp | 3 | ||||
-rw-r--r-- | src/startup.cpp | 3 |
2 files changed, 4 insertions, 2 deletions
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"(</(.*?):(\d+)>)"); 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, "<i>used <span color='#697ec4'>" + cmd + "</span> with " + app + "</i>"); diff --git a/src/startup.cpp b/src/startup.cpp index 6d1ac96..06d6402 100644 --- a/src/startup.cpp +++ b/src/startup.cpp @@ -54,7 +54,8 @@ std::optional<uint32_t> GetBuildNumberFromJSURL(const Glib::ustring &url, const auto regex = Glib::Regex::create(R"("buildNumber",null!==\(t="(\d+)\"\))"); Glib::MatchInfo match; - if (regex->match(res.text, match)) { + Glib::ustring string = res.text; + if (regex->match(string, match)) { const auto str_value = match.fetch(1); try { return std::stoul(str_value); |