mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-16 07:56:12 +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 << "Line: " << l.end.line << ". ";
|
||||||
parserError << "Column: " << l.end.column << ". ";
|
parserError << "Column: " << l.end.column << ". ";
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
if (m.empty() == false) {
|
if (m.empty() == false) {
|
||||||
parserError << " " << m << ".";
|
parserError << "" << m << " ";
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
if (c.empty() == false) {
|
if (c.empty() == false) {
|
||||||
parserError << c;
|
parserError << c;
|
||||||
}
|
}
|
||||||
|
@ -340,12 +340,12 @@ CONFIG_DIR_UNICODE_MAP_FILE (?i:SecUnicodeMapFile)
|
|||||||
}
|
}
|
||||||
|
|
||||||
[\n]+ { driver.loc.back()->lines(yyleng); driver.loc.back()->step(); }
|
[\n]+ { driver.loc.back()->lines(yyleng); driver.loc.back()->step(); }
|
||||||
#[ \t]*SecRule[^\\]*\\\n[ \t]* { BEGIN(COMMENT); }
|
#[ \t]*SecRule[^\\]*\\\n[ \t]* { driver.loc.back()->lines(1); driver.loc.back()->step(); BEGIN(COMMENT); }
|
||||||
#[ \t]*SecRule[^\\]*\\\r\n[ \t]* { BEGIN(COMMENT); }
|
#[ \t]*SecRule[^\\]*\\\r\n[ \t]* { driver.loc.back()->lines(1); driver.loc.back()->step(); BEGIN(COMMENT); }
|
||||||
#[ \t]*SecAction[^\\]*\\\n[ \t]* { BEGIN(COMMENT); }
|
#[ \t]*SecAction[^\\]*\\\n[ \t]* { driver.loc.back()->lines(1); driver.loc.back()->step(); BEGIN(COMMENT); }
|
||||||
#[ \t]*SecAction[^\\]*\\\r\n[ \t]* { BEGIN(COMMENT); }
|
#[ \t]*SecAction[^\\]*\\\r\n[ \t]* { driver.loc.back()->lines(1); driver.loc.back()->step(); BEGIN(COMMENT); }
|
||||||
#.* { /* comment, just ignore. */ }
|
#.* { driver.loc.back()->step(); /* comment, just ignore. */ }
|
||||||
. { driver.error (*driver.loc.back(), "invalid character", yytext); }
|
. { driver.error (*driver.loc.back(), "invalid character", yytext); throw yy::seclang_parser::syntax_error(*driver.loc.back(), yytext); }
|
||||||
<<EOF>> {
|
<<EOF>> {
|
||||||
if (driver.ref.size() > 0) {
|
if (driver.ref.size() > 0) {
|
||||||
driver.ref.pop_back();
|
driver.ref.pop_back();
|
||||||
|
@ -1 +1,2 @@
|
|||||||
|
|
||||||
include "owasp-modsecurity-crs-orig/modsecurity_crs_10_setup.conf"
|
include "owasp-modsecurity-crs-orig/modsecurity_crs_10_setup.conf"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user