summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2012-04-24 18:22:30 (GMT)
committerRemko Tronçon <git@el-tramo.be>2012-04-24 18:23:11 (GMT)
commit02c18de062510e8061598bf492c68cb5b0624831 (patch)
tree0d7fd23dad8e832fb8a15baf5e11295d44d4f9eb /3rdParty/Expat/src
parent98f0f0c5cee040d3b0df5ff4d695320b2f93da24 (diff)
downloadswift-02c18de062510e8061598bf492c68cb5b0624831.zip
swift-02c18de062510e8061598bf492c68cb5b0624831.tar.bz2
Make built-in expat ignore unbound prefix namespaces.
This works around a problem with broken servers relaying illegal stanzas from broken clients. Obviously only works when using the bundled Expat. Note that the system OS X libXML also seems to behave this way.
Diffstat (limited to '3rdParty/Expat/src')
-rwxr-xr-x3rdParty/Expat/src/xmlparse.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/3rdParty/Expat/src/xmlparse.c b/3rdParty/Expat/src/xmlparse.c
index 94e31de..ad5add2 100755
--- a/3rdParty/Expat/src/xmlparse.c
+++ b/3rdParty/Expat/src/xmlparse.c
@@ -2808,8 +2808,10 @@ storeAtts(XML_Parser parser, const ENCODING *enc,
((XML_Char *)s)[-1] = 0; /* clear flag */
id = (ATTRIBUTE_ID *)lookup(&dtd->attributeIds, s, 0);
b = id->prefix->binding;
- if (!b)
- return XML_ERROR_UNBOUND_PREFIX;
+ if (!b) {
+ //return XML_ERROR_UNBOUND_PREFIX;
+ continue;
+ }
/* as we expand the name we also calculate its hash value */
for (j = 0; j < b->uriLen; j++) {
@@ -2887,7 +2889,7 @@ storeAtts(XML_Parser parser, const ENCODING *enc,
return XML_ERROR_NONE;
/* expand the element type name */
- if (elementType->prefix) {
+ if (elementType->prefix && elementType->prefix->binding) {
binding = elementType->prefix->binding;
if (!binding)
return XML_ERROR_UNBOUND_PREFIX;
@@ -2983,10 +2985,10 @@ addBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId,
&& prefix->name[2] == XML_T(ASCII_l)) {
/* Not allowed to bind xmlns */
- if (prefix->name[3] == XML_T(ASCII_n)
+ /*if (prefix->name[3] == XML_T(ASCII_n)
&& prefix->name[4] == XML_T(ASCII_s)
&& prefix->name[5] == XML_T('\0'))
- return XML_ERROR_RESERVED_PREFIX_XMLNS;
+ return XML_ERROR_RESERVED_PREFIX_XMLNS;*/
if (prefix->name[3] == XML_T('\0'))
mustBeXML = XML_TRUE;
@@ -3003,12 +3005,12 @@ addBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId,
isXML = isXML && len == xmlLen;
isXMLNS = isXMLNS && len == xmlnsLen;
- if (mustBeXML != isXML)
+ /*if (mustBeXML != isXML)
return mustBeXML ? XML_ERROR_RESERVED_PREFIX_XML
- : XML_ERROR_RESERVED_NAMESPACE_URI;
+ : XML_ERROR_RESERVED_NAMESPACE_URI;*/
- if (isXMLNS)
- return XML_ERROR_RESERVED_NAMESPACE_URI;
+ /*if (isXMLNS)
+ return XML_ERROR_RESERVED_NAMESPACE_URI;*/
if (namespaceSeparator)
len++;