summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-06-01 21:09:23 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-06-01 21:09:23 (GMT)
commit9928be64a4c19f497302963d23ed0efc66b899c0 (patch)
tree1227659abb5814ac28bab2eaa84aefda8ff3f7a6 /Swiften/Parser/LibXMLParser.cpp
parent3f72e2c3b7ce5a83287dc136c68b7ef6d2cc66bd (diff)
downloadswift-contrib-9928be64a4c19f497302963d23ed0efc66b899c0.zip
swift-contrib-9928be64a4c19f497302963d23ed0efc66b899c0.tar.bz2
Added fix for a billion laughs attack on Expat.
Diffstat (limited to 'Swiften/Parser/LibXMLParser.cpp')
-rw-r--r--Swiften/Parser/LibXMLParser.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/Swiften/Parser/LibXMLParser.cpp b/Swiften/Parser/LibXMLParser.cpp
index 34db4ca..c94a360 100644
--- a/Swiften/Parser/LibXMLParser.cpp
+++ b/Swiften/Parser/LibXMLParser.cpp
@@ -15,20 +15,20 @@
namespace Swift {
-static void handleStartElement(void *client, const xmlChar* name, const xmlChar*, const xmlChar* xmlns, int, const xmlChar**, int nbAttributes, int, const xmlChar ** attributes) {
+static void handleStartElement(void *parser, const xmlChar* name, const xmlChar*, const xmlChar* xmlns, int, const xmlChar**, int nbAttributes, int, const xmlChar ** attributes) {
AttributeMap attributeValues;
for (int i = 0; i < nbAttributes*5; i += 5) {
attributeValues[std::string(reinterpret_cast<const char*>(attributes[i]))] = std::string(reinterpret_cast<const char*>(attributes[i+3]), attributes[i+4]-attributes[i+3]);
}
- static_cast<XMLParserClient*>(client)->handleStartElement(reinterpret_cast<const char*>(name), (xmlns ? reinterpret_cast<const char*>(xmlns) : std::string()), attributeValues);
+ static_cast<XMLParser*>(parser)->getClient()->handleStartElement(reinterpret_cast<const char*>(name), (xmlns ? reinterpret_cast<const char*>(xmlns) : std::string()), attributeValues);
}
-static void handleEndElement(void *client, const xmlChar* name, const xmlChar*, const xmlChar* xmlns) {
- static_cast<XMLParserClient*>(client)->handleEndElement(reinterpret_cast<const char*>(name), (xmlns ? reinterpret_cast<const char*>(xmlns) : std::string()));
+static void handleEndElement(void *parser, const xmlChar* name, const xmlChar*, const xmlChar* xmlns) {
+ static_cast<XMLParser*>(parser)->getClient()->handleEndElement(reinterpret_cast<const char*>(name), (xmlns ? reinterpret_cast<const char*>(xmlns) : std::string()));
}
-static void handleCharacterData(void* client, const xmlChar* data, int len) {
- static_cast<XMLParserClient*>(client)->handleCharacterData(std::string(reinterpret_cast<const char*>(data), len));
+static void handleCharacterData(void* parser, const xmlChar* data, int len) {
+ static_cast<XMLParser*>(parser)->getClient()->handleCharacterData(std::string(reinterpret_cast<const char*>(data), len));
}
static void handleError(void*, const char* /*m*/, ... ) {
@@ -54,7 +54,7 @@ LibXMLParser::LibXMLParser(XMLParserClient* client) : XMLParser(client) {
handler_.warning = &handleWarning;
handler_.error = &handleError;
- context_ = xmlCreatePushParserCtxt(&handler_, client, 0, 0, 0);
+ context_ = xmlCreatePushParserCtxt(&handler_, this, 0, 0, 0);
assert(context_);
}