Skip to content

Commit

Permalink
Respond to code review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonpayton committed Jan 19, 2023
1 parent d881efe commit 5a5b33d
Show file tree
Hide file tree
Showing 15 changed files with 2,537 additions and 2,528 deletions.
4 changes: 2 additions & 2 deletions headers/modsecurity/transaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class TransactionAnchoredVariables {
m_variableInboundDataError(t, "INBOUND_DATA_ERROR"),
m_variableMatchedVar(t, "MATCHED_VAR"),
m_variableMatchedVarName(t, "MATCHED_VAR_NAME"),
m_variableMscPcreErrored(t, "MSC_PCRE_ERRORED"),
m_variableMscPcreError(t, "MSC_PCRE_ERROR"),
m_variableMscPcreLimitsExceeded(t, "MSC_PCRE_LIMITS_EXCEEDED"),
m_variableMultipartBoundaryQuoted(t, "MULTIPART_BOUNDARY_QUOTED"),
m_variableMultipartBoundaryWhiteSpace(t,
Expand Down Expand Up @@ -221,7 +221,7 @@ class TransactionAnchoredVariables {
AnchoredVariable m_variableInboundDataError;
AnchoredVariable m_variableMatchedVar;
AnchoredVariable m_variableMatchedVarName;
AnchoredVariable m_variableMscPcreErrored;
AnchoredVariable m_variableMscPcreError;
AnchoredVariable m_variableMscPcreLimitsExceeded;
AnchoredVariable m_variableMultipartBoundaryQuoted;
AnchoredVariable m_variableMultipartBoundaryWhiteSpace;
Expand Down
2 changes: 1 addition & 1 deletion src/operators/rx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ bool Rx::evaluate(Transaction *transaction, RuleWithActions *rule,

// FIXME: DRY regex error reporting. This logic is currently duplicated in other operators.
if (regex_result != Utils::RegexResult::Ok) {
transaction->m_variableMscPcreErrored.set("1", transaction->m_variableOffset);
transaction->m_variableMscPcreError.set("1", transaction->m_variableOffset);

std::string regex_error_str = "OTHER";
if (regex_result == Utils::RegexResult::ErrorMatchLimit) {
Expand Down
2 changes: 1 addition & 1 deletion src/operators/rx_global.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ bool RxGlobal::evaluate(Transaction *transaction, RuleWithActions *rule,

// FIXME: DRY regex error reporting. This logic is currently duplicated in other operators.
if (regex_result != Utils::RegexResult::Ok) {
transaction->m_variableMscPcreErrored.set("1", transaction->m_variableOffset);
transaction->m_variableMscPcreError.set("1", transaction->m_variableOffset);

std::string regex_error_str = "OTHER";
if (regex_result == Utils::RegexResult::ErrorMatchLimit) {
Expand Down
4 changes: 2 additions & 2 deletions src/parser/location.hh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// A Bison parser, made by GNU Bison 3.7.5.
// A Bison parser, made by GNU Bison 3.8.2.

// Locations for Bison parsers in C++

Expand All @@ -15,7 +15,7 @@
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// along with this program. If not, see <https://www.gnu.org/licenses/>.

// As a special exception, you may create a larger work that contains
// part or all of the Bison parser skeleton and distribute that work
Expand Down
2 changes: 1 addition & 1 deletion src/parser/position.hh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// A Bison parser, made by GNU Bison 3.7.5.
// A Bison parser, made by GNU Bison 3.8.2.

// Starting with Bison 3.2, this file is useless: the structure it
// used to define is now defined in "location.hh".
Expand Down
35 changes: 19 additions & 16 deletions src/parser/seclang-parser.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// A Bison parser, made by GNU Bison 3.7.5.
// A Bison parser, made by GNU Bison 3.8.2.

// Skeleton implementation for Bison LALR(1) parsers in C++

Expand All @@ -15,7 +15,7 @@
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// along with this program. If not, see <https://www.gnu.org/licenses/>.

// As a special exception, you may create a larger work that contains
// part or all of the Bison parser skeleton and distribute that work
Expand Down Expand Up @@ -157,9 +157,9 @@ namespace yy {
seclang_parser::syntax_error::~syntax_error () YY_NOEXCEPT YY_NOTHROW
{}

/*---------------.
| symbol kinds. |
`---------------*/
/*---------.
| symbol. |
`---------*/



Expand Down Expand Up @@ -1230,7 +1230,7 @@ namespace yy {
}

void
seclang_parser::yypop_ (int n)
seclang_parser::yypop_ (int n) YY_NOEXCEPT
{
yystack_.pop (n);
}
Expand Down Expand Up @@ -1273,13 +1273,13 @@ namespace yy {
}

bool
seclang_parser::yy_pact_value_is_default_ (int yyvalue)
seclang_parser::yy_pact_value_is_default_ (int yyvalue) YY_NOEXCEPT
{
return yyvalue == yypact_ninf_;
}

bool
seclang_parser::yy_table_value_is_error_ (int yyvalue)
seclang_parser::yy_table_value_is_error_ (int yyvalue) YY_NOEXCEPT
{
return yyvalue == yytable_ninf_;
}
Expand Down Expand Up @@ -4273,10 +4273,10 @@ namespace yy {
#line 4274 "seclang-parser.cc"
break;

case 275: // var: "MSC_PCRE_ERRORED"
case 275: // var: "MSC_PCRE_ERROR"
#line 2327 "seclang-parser.yy"
{
VARIABLE_CONTAINER(yylhs.value.as < std::unique_ptr<Variable> > (), new variables::MscPcreErrored());
VARIABLE_CONTAINER(yylhs.value.as < std::unique_ptr<Variable> > (), new variables::MscPcreError());
}
#line 4282 "seclang-parser.cc"
break;
Expand Down Expand Up @@ -5938,16 +5938,16 @@ namespace yy {
// Actual number of expected tokens
int yycount = 0;

int yyn = yypact_[+yyparser_.yystack_[0].state];
const int yyn = yypact_[+yyparser_.yystack_[0].state];
if (!yy_pact_value_is_default_ (yyn))
{
/* Start YYX at -YYN if negative to avoid negative indexes in
YYCHECK. In other words, skip the first -YYN actions for
this state because they are default actions. */
int yyxbegin = yyn < 0 ? -yyn : 0;
const int yyxbegin = yyn < 0 ? -yyn : 0;
// Stay within bounds of both yycheck and yytname.
int yychecklim = yylast_ - yyn + 1;
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
const int yychecklim = yylast_ - yyn + 1;
const int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
for (int yyx = yyxbegin; yyx < yyxend; ++yyx)
if (yycheck_[yyx + yyn] == yyx && yyx != symbol_kind::S_YYerror
&& !yy_table_value_is_error_ (yytable_[yyx + yyn]))
Expand All @@ -5968,6 +5968,9 @@ namespace yy {






int
seclang_parser::yy_syntax_error_arguments_ (const context& yyctx,
symbol_kind_type yyarg[], int yyargn) const
Expand Down Expand Up @@ -7051,7 +7054,7 @@ namespace yy {
"VARIABLE_RULE", "\"Variable ARGS_NAMES\"", "VARIABLE_ARGS_POST_NAMES",
"\"AUTH_TYPE\"", "\"FILES_COMBINED_SIZE\"", "\"FILES_TMPNAMES\"",
"\"FULL_REQUEST\"", "\"FULL_REQUEST_LENGTH\"", "\"INBOUND_DATA_ERROR\"",
"\"MATCHED_VAR\"", "\"MATCHED_VAR_NAME\"", "\"MSC_PCRE_ERRORED\"",
"\"MATCHED_VAR\"", "\"MATCHED_VAR_NAME\"", "\"MSC_PCRE_ERROR\"",
"\"MSC_PCRE_LIMITS_EXCEEDED\"", "VARIABLE_MULTIPART_BOUNDARY_QUOTED",
"VARIABLE_MULTIPART_BOUNDARY_WHITESPACE", "\"MULTIPART_CRLF_LF_LINES\"",
"\"MULTIPART_DATA_AFTER\"", "VARIABLE_MULTIPART_DATA_BEFORE",
Expand Down Expand Up @@ -7296,7 +7299,7 @@ namespace yy {


} // yy
#line 7300 "seclang-parser.cc"
#line 7303 "seclang-parser.cc"

#line 3075 "seclang-parser.yy"

Expand Down

0 comments on commit 5a5b33d

Please sign in to comment.