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