summaryrefslogtreecommitdiff
path: root/SAX2.c
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@redhat.com>2009-09-07 12:15:08 +0200
committerDaniel Veillard <veillard@redhat.com>2009-09-07 12:15:08 +0200
commitd44b9364991bd0067d50c29bdff48305dfdad4ce (patch)
treee692ab08e4ba1ca12c128aaf5a029cd5f3a1e057 /SAX2.c
parent76d364583ecb6a48bd4a4087f3cef9fc7838b481 (diff)
downloadlibxml2-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.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/SAX2.c b/SAX2.c
index 94b39d46..1cf186ac 100644
--- a/SAX2.c
+++ b/SAX2.c
@@ -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;
}