Removes slash from REQUEST_BASENAME

This commit is contained in:
Felipe Zimmerle 2016-11-22 15:33:32 -03:00
parent 293a849668
commit d3a4ec760c
No known key found for this signature in database
GPG Key ID: E6DFB08CE8B11277
2 changed files with 4 additions and 4 deletions

View File

@ -406,9 +406,9 @@ int Transaction::processURI(const char *uri, const char *method,
m_collections.store("REQUEST_FILENAME", path_info); m_collections.store("REQUEST_FILENAME", path_info);
size_t offset = path_info.find_last_of("/\\"); size_t offset = path_info.find_last_of("/\\");
if (offset != std::string::npos) { if (offset != std::string::npos && path_info.length() > offset + 1) {
std::string basename = std::string(path_info, offset, std::string basename = std::string(path_info, offset + 1,
path_info.length() - offset); path_info.length() - (offset + 1));
m_collections.store("REQUEST_BASENAME", basename); m_collections.store("REQUEST_BASENAME", basename);
} }
m_collections.store("REQUEST_METHOD", method); m_collections.store("REQUEST_METHOD", method);

View File

@ -33,7 +33,7 @@
] ]
}, },
"expected":{ "expected":{
"debug_log":"Target value: \"/login.php\" \\(Variable: REQUEST_BASENAME\\)" "debug_log":"Target value: \"login.php\" \\(Variable: REQUEST_BASENAME\\)"
}, },
"rules":[ "rules":[
"SecRuleEngine On", "SecRuleEngine On",