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