mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-30 11:44:32 +03:00
Adds offset regression tests and assorted fixes on var's offsets
This commit is contained in:
committed by
Felipe Zimmerle
parent
795994bb0e
commit
4ad3574cf2
@@ -56,6 +56,18 @@ void AnchoredVariable::unset() {
|
||||
}
|
||||
|
||||
|
||||
void AnchoredVariable::set(const std::string &a, size_t offset,
|
||||
size_t offsetLen) {
|
||||
std::unique_ptr<VariableOrigin> origin(new VariableOrigin());
|
||||
|
||||
m_offset = offset;
|
||||
m_value.assign(a.c_str(), a.size());
|
||||
origin->m_offset = offset;
|
||||
origin->m_length = offsetLen;
|
||||
m_var->m_orign.push_back(std::move(origin));
|
||||
}
|
||||
|
||||
|
||||
void AnchoredVariable::set(const std::string &a, size_t offset) {
|
||||
std::unique_ptr<VariableOrigin> origin(new VariableOrigin());
|
||||
|
||||
@@ -84,6 +96,23 @@ void AnchoredVariable::append(const std::string &a, size_t offset,
|
||||
}
|
||||
|
||||
|
||||
void AnchoredVariable::append(const std::string &a, size_t offset,
|
||||
bool spaceSeparator, int size) {
|
||||
std::unique_ptr<VariableOrigin> origin(
|
||||
new VariableOrigin());
|
||||
|
||||
if (spaceSeparator && !m_value.empty()) {
|
||||
m_value.append(" " + a);
|
||||
} else {
|
||||
m_value.append(a);
|
||||
}
|
||||
m_offset = offset;
|
||||
origin->m_offset = offset;
|
||||
origin->m_length = size;
|
||||
m_var->m_orign.push_back(std::move(origin));
|
||||
}
|
||||
|
||||
|
||||
void AnchoredVariable::evaluate(std::vector<const collection::Variable *> *l) {
|
||||
if (m_name.empty() || m_var == NULL || m_var->m_key == NULL
|
||||
|| m_var->m_value == NULL || m_var->m_key->empty()) {
|
||||
|
Reference in New Issue
Block a user