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