summaryrefslogtreecommitdiff
blob: 507382f66f678b574101d70d427e37bd15856525 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
From 380abf66e930f5c4ead591014f31624d80a3151c Mon Sep 17 00:00:00 2001
From: Florian Schmaus <flo@geekplace.eu>
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<void*>(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