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