lib: Protect against malicious namespace declarations (CVE-2022-25236)
This commit is contained in:
parent
6881a4fc85
commit
a2fe525e66
@ -3754,6 +3754,17 @@ addBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId,
|
||||
if (! mustBeXML && isXMLNS
|
||||
&& (len > xmlnsLen || uri[len] != xmlnsNamespace[len]))
|
||||
isXMLNS = XML_FALSE;
|
||||
|
||||
// NOTE: While Expat does not validate namespace URIs against RFC 3986,
|
||||
// we have to at least make sure that the XML processor on top of
|
||||
// Expat (that is splitting tag names by namespace separator into
|
||||
// 2- or 3-tuples (uri-local or uri-local-prefix)) cannot be confused
|
||||
// by an attacker putting additional namespace separator characters
|
||||
// into namespace declarations. That would be ambiguous and not to
|
||||
// be expected.
|
||||
if (parser->m_ns && (uri[len] == parser->m_namespaceSeparator)) {
|
||||
return XML_ERROR_SYNTAX;
|
||||
}
|
||||
}
|
||||
isXML = isXML && len == xmlLen;
|
||||
isXMLNS = isXMLNS && len == xmlnsLen;
|
||||
|
Loading…
Reference in New Issue
Block a user