Module: check_mk
Branch: master
Commit: 70fee228c4b8752398c4200cc0190d2f65d24475
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=70fee228c4b875…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Fri Dec 7 14:37:00 2018 +0100
6964 FIX Fixed matching of literal strings when C++11 regex engine is used.
Livestatus and CMC can use one of two regex engines: Either then one from
the C++11 standard library or the one from the RE2 library. Normal builds
ship the latter, only a manually built Livestatus should ever use the
former. Nevertheless, both should work, but the C++11 variant had a quoting
bug, resulting in incorrect matching. This has been fixed.
Change-Id: Iaeb5db079c11db6f85ab22ee45c8dd4b2a8532a0
---
.werks/6964 | 14 ++++++++++++++
livestatus/src/RegExp.cc | 4 ++--
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/.werks/6964 b/.werks/6964
new file mode 100644
index 0000000..b8c1ebe
--- /dev/null
+++ b/.werks/6964
@@ -0,0 +1,14 @@
+Title: Fixed matching of literal strings when C++11 regex engine is used.
+Level: 2
+Component: livestatus
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1544189517
+Class: fix
+
+Livestatus and CMC can use one of two regex engines: Either then one from
+the C++11 standard library or the one from the RE2 library. Normal builds
+ship the latter, only a manually built Livestatus should ever use the
+former. Nevertheless, both should work, but the C++11 variant had a quoting
+bug, resulting in incorrect matching. This has been fixed.
diff --git a/livestatus/src/RegExp.cc b/livestatus/src/RegExp.cc
index eff949d..8e60074 100644
--- a/livestatus/src/RegExp.cc
+++ b/livestatus/src/RegExp.cc
@@ -79,8 +79,8 @@ public:
Impl(const std::string &str, Case c, Syntax s)
: _regex(s == Syntax::literal
? std::regex_replace(
- str, std::regex(R"([.^$|()\[\]{}*+?\\])"),
- R"(\&)", std::regex_constants::format_sed)
+ str, std::regex(R"([.^$|()\[\]{}*+?\\])"),
R"(\\&)",
+ std::regex_constants::format_sed)
: str,
c == Case::respect
? std::regex::extended