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