mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-30 03:34:29 +03:00
fix negated implicit @rx operator
When an operator starts with '!' and no explicit operator is specified, a negated @rx operator should be created. Due to a bug, a regular @rx operator with regex starting with '!' was created. This commit fixes it
This commit is contained in:
committed by
Felipe Zimmerle
parent
ca9cbf4ddc
commit
039bd2cc84
@@ -1459,7 +1459,7 @@ namespace yy {
|
|||||||
case 33:
|
case 33:
|
||||||
#line 855 "seclang-parser.yy" // lalr1.cc:859
|
#line 855 "seclang-parser.yy" // lalr1.cc:859
|
||||||
{
|
{
|
||||||
OPERATOR_CONTAINER(yylhs.value.as< std::unique_ptr<Operator> > (), new operators::Rx("!" + utils::string::removeBracketsIfNeeded(yystack_[0].value.as< std::string > ())));
|
OPERATOR_CONTAINER(yylhs.value.as< std::unique_ptr<Operator> > (), new operators::Rx("Rx", utils::string::removeBracketsIfNeeded(yystack_[0].value.as< std::string > ()), true));
|
||||||
std::string error;
|
std::string error;
|
||||||
if (yylhs.value.as< std::unique_ptr<Operator> > ()->init(driver.ref.back(), &error) == false) {
|
if (yylhs.value.as< std::unique_ptr<Operator> > ()->init(driver.ref.back(), &error) == false) {
|
||||||
driver.error(yystack_[2].location, error);
|
driver.error(yystack_[2].location, error);
|
||||||
|
@@ -853,7 +853,7 @@ op:
|
|||||||
}
|
}
|
||||||
| NOT OPERATOR_RX_CONTENT_ONLY
|
| NOT OPERATOR_RX_CONTENT_ONLY
|
||||||
{
|
{
|
||||||
OPERATOR_CONTAINER($$, new operators::Rx("!" + utils::string::removeBracketsIfNeeded($2)));
|
OPERATOR_CONTAINER($$, new operators::Rx("Rx", utils::string::removeBracketsIfNeeded($2), true));
|
||||||
std::string error;
|
std::string error;
|
||||||
if ($$->init(driver.ref.back(), &error) == false) {
|
if ($$->init(driver.ref.back(), &error) == false) {
|
||||||
driver.error(@0, error);
|
driver.error(@0, error);
|
||||||
|
Reference in New Issue
Block a user