155c30
diff -up thunderbird-91.7.0/parser/expat/lib/xmlparse.c.expat-CVE-2022-25236 thunderbird-91.7.0/parser/expat/lib/xmlparse.c
155c30
--- thunderbird-91.7.0/parser/expat/lib/xmlparse.c.expat-CVE-2022-25236	2022-03-02 18:08:40.085642028 +0100
155c30
+++ thunderbird-91.7.0/parser/expat/lib/xmlparse.c	2022-03-02 18:13:31.838667958 +0100
155c30
@@ -700,8 +700,7 @@ XML_ParserCreate(const XML_Char *encodin
155c30
 XML_Parser XMLCALL
155c30
 XML_ParserCreateNS(const XML_Char *encodingName, XML_Char nsSep)
155c30
 {
155c30
-  XML_Char tmp[2];
155c30
-  *tmp = nsSep;
155c30
+  XML_Char tmp[2] = {nsSep, 0};
155c30
   return XML_ParserCreate_MM(encodingName, NULL, tmp);
155c30
 }
155c30
 #endif
155c30
@@ -1276,8 +1275,7 @@ XML_ExternalEntityParserCreate(XML_Parse
155c30
      would be otherwise.
155c30
   */
155c30
   if (ns) {
155c30
-    XML_Char tmp[2];
155c30
-    *tmp = namespaceSeparator;
155c30
+    XML_Char tmp[2] = {parser->m_namespaceSeparator, 0};
155c30
     parser = parserCreate(encodingName, &parser->m_mem, tmp, newDtd);
155c30
   }
155c30
   else {
155c30
@@ -3667,6 +3665,16 @@ addBinding(XML_Parser parser, PREFIX *pr
155c30
     if (!mustBeXML && isXMLNS
155c30
         && (len > xmlnsLen || uri[len] != xmlnsNamespace[len]))
155c30
       isXMLNS = XML_FALSE;
155c30
+    // NOTE: While Expat does not validate namespace URIs against RFC 3986,
155c30
+    //       we have to at least make sure that the XML processor on top of
155c30
+    //       Expat (that is splitting tag names by namespace separator into
155c30
+    //       2- or 3-tuples (uri-local or uri-local-prefix)) cannot be confused
155c30
+    //       by an attacker putting additional namespace separator characters
155c30
+    //       into namespace declarations.  That would be ambiguous and not to
155c30
+    //       be expected.
155c30
+    if (parser->m_ns && (uri[len] == parser->m_namespaceSeparator)) {
155c30
+      return XML_ERROR_SYNTAX;
155c30
+    }
155c30
   }
155c30
   isXML = isXML && len == xmlLen;
155c30
   isXMLNS = isXMLNS && len == xmlnsLen;