mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-14 05:45:59 +03:00
Fix the "line counting" on parser errors
This commit is contained in:
parent
70e2a4b379
commit
d084ab5f2d
@ -169,11 +169,11 @@ void Driver::error(const yy::location& l, const std::string& m,
|
||||
parserError << "Line: " << l.end.line << ". ";
|
||||
parserError << "Column: " << l.end.column << ". ";
|
||||
}
|
||||
/*
|
||||
|
||||
if (m.empty() == false) {
|
||||
parserError << " " << m << ".";
|
||||
parserError << "" << m << " ";
|
||||
}
|
||||
*/
|
||||
|
||||
if (c.empty() == false) {
|
||||
parserError << c;
|
||||
}
|
||||
|
@ -340,12 +340,12 @@ CONFIG_DIR_UNICODE_MAP_FILE (?i:SecUnicodeMapFile)
|
||||
}
|
||||
|
||||
[\n]+ { driver.loc.back()->lines(yyleng); driver.loc.back()->step(); }
|
||||
#[ \t]*SecRule[^\\]*\\\n[ \t]* { BEGIN(COMMENT); }
|
||||
#[ \t]*SecRule[^\\]*\\\r\n[ \t]* { BEGIN(COMMENT); }
|
||||
#[ \t]*SecAction[^\\]*\\\n[ \t]* { BEGIN(COMMENT); }
|
||||
#[ \t]*SecAction[^\\]*\\\r\n[ \t]* { BEGIN(COMMENT); }
|
||||
#.* { /* comment, just ignore. */ }
|
||||
. { driver.error (*driver.loc.back(), "invalid character", yytext); }
|
||||
#[ \t]*SecRule[^\\]*\\\n[ \t]* { driver.loc.back()->lines(1); driver.loc.back()->step(); BEGIN(COMMENT); }
|
||||
#[ \t]*SecRule[^\\]*\\\r\n[ \t]* { driver.loc.back()->lines(1); driver.loc.back()->step(); BEGIN(COMMENT); }
|
||||
#[ \t]*SecAction[^\\]*\\\n[ \t]* { driver.loc.back()->lines(1); driver.loc.back()->step(); BEGIN(COMMENT); }
|
||||
#[ \t]*SecAction[^\\]*\\\r\n[ \t]* { driver.loc.back()->lines(1); driver.loc.back()->step(); BEGIN(COMMENT); }
|
||||
#.* { driver.loc.back()->step(); /* comment, just ignore. */ }
|
||||
. { driver.error (*driver.loc.back(), "invalid character", yytext); throw yy::seclang_parser::syntax_error(*driver.loc.back(), yytext); }
|
||||
<<EOF>> {
|
||||
if (driver.ref.size() > 0) {
|
||||
driver.ref.pop_back();
|
||||
|
@ -1 +1,2 @@
|
||||
|
||||
include "owasp-modsecurity-crs-orig/modsecurity_crs_10_setup.conf"
|
||||
|
Loading…
x
Reference in New Issue
Block a user