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