mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-13 13:26:01 +03:00
Change node value's parsing to concatenate instead of copy it every time
This commit is contained in:
parent
bf707de08f
commit
e8dc60ee06
@ -71,6 +71,10 @@ class MSCSAXHandler {
|
||||
xml_data->nodes[xml_data->nodes.size()-1]->has_child = true;
|
||||
}
|
||||
xml_data->currpath.append(name);
|
||||
// set the current value empty
|
||||
// this is necessary because if there is any text between the tags (new line, etc)
|
||||
// it will be added to the current value
|
||||
xml_data->currval = "";
|
||||
}
|
||||
|
||||
void onEndElement(void * ctx, const xmlChar *localname) {
|
||||
@ -92,13 +96,17 @@ class MSCSAXHandler {
|
||||
}
|
||||
xml_data->nodes.pop_back();
|
||||
xml_data->node_depth--;
|
||||
xml_data->currval = "";
|
||||
}
|
||||
|
||||
void onCharacters(void *ctx, const xmlChar *ch, int len) {
|
||||
XMLNodes* xml_data = static_cast<XMLNodes*>(ctx);
|
||||
std::string content(reinterpret_cast<const char *>(ch), len);
|
||||
|
||||
xml_data->currval = content;
|
||||
// libxml2 SAX parser will call this function multiple times
|
||||
// during the parsing of a single node, if the value has multibyte
|
||||
// characters, so we need to concatenate the values
|
||||
xml_data->currval += content;
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user