From 380abf66e930f5c4ead591014f31624d80a3151c Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Sat, 26 Feb 2022 21:41:34 +0100 Subject: [PATCH] Fix bad namespace separator Fixes: https://lab.louiz.org/louiz/biboumi/-/issues/3465 --- src/xmpp/xmpp_parser.cpp | 2 +- src/xmpp/xmpp_parser.hpp | 4 ++-- src/xmpp/xmpp_stanza.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/xmpp/xmpp_parser.cpp b/src/xmpp/xmpp_parser.cpp index 781fe4cd94b0..1f25fa6f982b 100644 --- a/src/xmpp/xmpp_parser.cpp +++ b/src/xmpp/xmpp_parser.cpp @@ -38,7 +38,7 @@ XmppParser::XmppParser(): void XmppParser::init_xml_parser() { // Create the expat parser - this->parser = XML_ParserCreateNS("UTF-8", ':'); + this->parser = XML_ParserCreateNS("UTF-8", '\1'); XML_SetUserData(this->parser, static_cast(this)); // Install Expat handlers diff --git a/src/xmpp/xmpp_parser.hpp b/src/xmpp/xmpp_parser.hpp index ec42f9a326e1..1e5e4e55a875 100644 --- a/src/xmpp/xmpp_parser.hpp +++ b/src/xmpp/xmpp_parser.hpp @@ -18,9 +18,9 @@ * stanza is reasonnably short. * * The element names generated by expat contain the namespace of the - * element, a colon (':') and then the actual name of the element. To get + * element, a \1 separator and then the actual name of the element. To get * an element "x" with a namespace of "http://jabber.org/protocol/muc", you - * just look for an XmlNode named "http://jabber.org/protocol/muc:x" + * just look for an XmlNode named "http://jabber.org/protocol/muc\1x" * * TODO: enforce the size-limit for the stanza (limit the number of childs * it can contain). For example forbid the parser going further than level diff --git a/src/xmpp/xmpp_stanza.cpp b/src/xmpp/xmpp_stanza.cpp index 435f33313b09..bd668cf2f28d 100644 --- a/src/xmpp/xmpp_stanza.cpp +++ b/src/xmpp/xmpp_stanza.cpp @@ -52,7 +52,7 @@ XmlNode::XmlNode(const std::string& name, XmlNode* parent): parent(parent) { // split the namespace and the name - auto n = name.rfind(':'); + auto n = name.rfind('\1'); if (n == std::string::npos) this->name = name; else -- 2.34.1