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