xml parser BUGFIX use of unitialized memory
diff --git a/src/xml.c b/src/xml.c
index 489701e..cf2fb40 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -44,24 +44,17 @@
lyxml_get_ns(const struct lyxml_elem *elem, const char *prefix)
{
struct lyxml_attr *attr;
- int len;
if (!elem) {
return NULL;
}
- if (!prefix) {
- len = 0;
- } else {
- len = strlen(prefix) + 1;
- }
-
for (attr = elem->attr; attr; attr = attr->next) {
if (attr->type != LYXML_ATTR_NS) {
continue;
}
if (!attr->name) {
- if (!len) {
+ if (!prefix) {
/* default namespace found */
if (!attr->value) {
/* empty default namespace -> no default namespace */
@@ -69,7 +62,7 @@
}
return (struct lyxml_ns *)attr;
}
- } else if (len && !memcmp(attr->name, prefix, len)) {
+ } else if (!strcmp(attr->name, prefix)) {
/* prefix found */
return (struct lyxml_ns *)attr;
}