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