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