mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-10-01 03:57:47 +03:00
Fix pcre_exec offset values
This commit is contained in:
@@ -80,7 +80,7 @@ std::list<SMatch> Regex::searchAll(const std::string& s) {
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
rc = pcre_exec(m_pc, m_pce, subject,
|
rc = pcre_exec(m_pc, m_pce, subject,
|
||||||
s.size() - offset, offset, 0, ovector, OVECCOUNT);
|
s.size(), offset, 0, ovector, OVECCOUNT);
|
||||||
|
|
||||||
for (i = 0; i < rc; i++) {
|
for (i = 0; i < rc; i++) {
|
||||||
SMatch match;
|
SMatch match;
|
||||||
@@ -88,12 +88,18 @@ std::list<SMatch> Regex::searchAll(const std::string& s) {
|
|||||||
size_t end = ovector[2*i+1];
|
size_t end = ovector[2*i+1];
|
||||||
size_t len = end - start;
|
size_t len = end - start;
|
||||||
if (end > s.size()) {
|
if (end > s.size()) {
|
||||||
continue;
|
rc = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (len == 0) {
|
||||||
|
rc = 0;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
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;
|
offset = start + len;
|
||||||
|
|
||||||
retList.push_front(match);
|
retList.push_front(match);
|
||||||
}
|
}
|
||||||
} while (rc > 0);
|
} while (rc > 0);
|
||||||
|
Reference in New Issue
Block a user