mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-16 07:56:12 +03:00
Fix Regex::searchAll to behave like global modifier
This commit is contained in:
parent
4d66481bfa
commit
7aae5dc183
@ -72,15 +72,15 @@ Regex::~Regex() {
|
|||||||
|
|
||||||
|
|
||||||
std::list<SMatch> Regex::searchAll(const std::string& s) {
|
std::list<SMatch> Regex::searchAll(const std::string& s) {
|
||||||
int ovector[OVECCOUNT];
|
|
||||||
std::list<SMatch> retList;
|
|
||||||
int i;
|
|
||||||
const char *subject = s.c_str();
|
const char *subject = s.c_str();
|
||||||
int rc;
|
|
||||||
const std::string tmpString = std::string(s.c_str(), s.size());
|
const std::string tmpString = std::string(s.c_str(), s.size());
|
||||||
|
int ovector[OVECCOUNT];
|
||||||
|
int rc, i, offset = 0;
|
||||||
|
std::list<SMatch> retList;
|
||||||
|
|
||||||
|
do {
|
||||||
rc = pcre_exec(m_pc, m_pce, subject,
|
rc = pcre_exec(m_pc, m_pce, subject,
|
||||||
s.size(), 0, 0, ovector, OVECCOUNT);
|
s.size() - offset, offset, 0, ovector, OVECCOUNT);
|
||||||
|
|
||||||
for (i = 0; i < rc; i++) {
|
for (i = 0; i < rc; i++) {
|
||||||
SMatch match;
|
SMatch match;
|
||||||
@ -93,8 +93,10 @@ std::list<SMatch> Regex::searchAll(const std::string& s) {
|
|||||||
match.match = std::string(tmpString, start, len);
|
match.match = std::string(tmpString, start, len);
|
||||||
match.m_offset = start;
|
match.m_offset = start;
|
||||||
match.m_length = len;
|
match.m_length = len;
|
||||||
|
offset = start + len;
|
||||||
retList.push_front(match);
|
retList.push_front(match);
|
||||||
}
|
}
|
||||||
|
} while (rc > 0);
|
||||||
|
|
||||||
return retList;
|
return retList;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user