From: Francis Dupont Date: Tue, 11 Jun 2024 14:12:24 +0000 (+0200) Subject: [#3170] Addressed comments X-Git-Tag: Kea-2.7.0~48 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dce8f0d3f3865fca10bf4988603ee4176af0eb67;p=thirdparty%2Fkea.git [#3170] Addressed comments --- diff --git a/ChangeLog b/ChangeLog index 85efeb9519..ea81c86098 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,6 @@ 2253. [func] fdupont Added the predicate token "match" which evaluates regular - expression matching. + expression matching to classification expression. (Gitlab #3170) 2252. [bug] fdupont diff --git a/doc/sphinx/arm/classify.rst b/doc/sphinx/arm/classify.rst index a32fbbe483..4b167ccf6b 100644 --- a/doc/sphinx/arm/classify.rst +++ b/doc/sphinx/arm/classify.rst @@ -585,7 +585,7 @@ So inequality, case insensitive pattern matching or pattern search. Detected invalid regular expressions are considered as syntax errors, runtime exceptions during match are handled as no match. - Be careful with the match operator as it can show extremely bad + Be careful with the match operator as it can result in very poor performance leading to regular expression denial of service (ReDoS). diff --git a/src/lib/eval/eval_messages.mes b/src/lib/eval/eval_messages.mes index 1c62431c51..ec31028540 100644 --- a/src/lib/eval/eval_messages.mes +++ b/src/lib/eval/eval_messages.mes @@ -91,8 +91,8 @@ This debug message indicates that the given regular expression was matched with the popped value. The result was pushed onto the value stack. % EVAL_DEBUG_MATCH_ERROR Matching '%1' on %2 raised an error: %3 -This error message indicates that the given regular expression was matched -with the popped value. An error was raised. +This error message indicates that an error occurred while evaluating the given +regular expression against the popped value. # For use with TokenMember diff --git a/src/lib/eval/tests/token_unittest.cc b/src/lib/eval/tests/token_unittest.cc index cfadbc0318..2b87ef8ac0 100644 --- a/src/lib/eval/tests/token_unittest.cc +++ b/src/lib/eval/tests/token_unittest.cc @@ -553,7 +553,7 @@ public: /// /// @param reg_exp regular expression /// @param value value to match - /// @param matched true or false + /// @param matched expected outcome of the match void testMatch(const std::string& reg_exp, const std::string& value, bool matched) { clearStack(); diff --git a/src/lib/eval/token.h b/src/lib/eval/token.h index 43fe292175..b37a9867d5 100644 --- a/src/lib/eval/token.h +++ b/src/lib/eval/token.h @@ -1338,7 +1338,8 @@ public: /// @brief Match regular expression /// /// Evaluation uses only the last parameter (top of stack) which is popped. - /// "true" when the regular expression or "false" otherwise is pushed. + /// Pushes "true" when the regular expression evaluates to true, + /// pushes "false" otherwise. /// /// @param pkt (unused) /// @param values - stack of values (1 popped, 1 pushed)