diff options
author | Daniel Veillard <veillard@redhat.com> | 2009-09-07 12:15:08 +0200 |
---|---|---|
committer | Daniel Veillard <veillard@redhat.com> | 2009-09-07 12:15:08 +0200 |
commit | d44b9364991bd0067d50c29bdff48305dfdad4ce (patch) | |
tree | e692ab08e4ba1ca12c128aaf5a029cd5f3a1e057 /SAX2.c | |
parent | 76d364583ecb6a48bd4a4087f3cef9fc7838b481 (diff) | |
download | libxml2-d44b9364991bd0067d50c29bdff48305dfdad4ce.tar.gz |
A few more safety cleanup raised by scan
* SAX2.c encoding.c parser.c xmlschemas.c: a few more safety checks
* relaxng.c: remove an unused intitialization
Diffstat (limited to 'SAX2.c')
-rw-r--r-- | SAX2.c | 40 |
1 files changed, 21 insertions, 19 deletions
@@ -1246,30 +1246,32 @@ xmlSAX2AttributeInternal(void *ctx, const xmlChar *fullname, } if (ns != NULL) { - xmlAttrPtr prop; namespace = xmlSearchNs(ctxt->myDoc, ctxt->node, ns); + if (namespace == NULL) { xmlNsErrMsg(ctxt, XML_NS_ERR_UNDEFINED_NAMESPACE, "Namespace prefix %s of attribute %s is not defined\n", ns, name); - } - - prop = ctxt->node->properties; - while (prop != NULL) { - if (prop->ns != NULL) { - if ((xmlStrEqual(name, prop->name)) && - ((namespace == prop->ns) || - (xmlStrEqual(namespace->href, prop->ns->href)))) { - xmlNsErrMsg(ctxt, XML_ERR_ATTRIBUTE_REDEFINED, - "Attribute %s in %s redefined\n", - name, namespace->href); - ctxt->wellFormed = 0; - if (ctxt->recovery == 0) ctxt->disableSAX = 1; - goto error; - } - } - prop = prop->next; - } + } else { + xmlAttrPtr prop; + + prop = ctxt->node->properties; + while (prop != NULL) { + if (prop->ns != NULL) { + if ((xmlStrEqual(name, prop->name)) && + ((namespace == prop->ns) || + (xmlStrEqual(namespace->href, prop->ns->href)))) { + xmlNsErrMsg(ctxt, XML_ERR_ATTRIBUTE_REDEFINED, + "Attribute %s in %s redefined\n", + name, namespace->href); + ctxt->wellFormed = 0; + if (ctxt->recovery == 0) ctxt->disableSAX = 1; + goto error; + } + } + prop = prop->next; + } + } } else { namespace = NULL; } |