$NetBSD$ Avoid possible NULL pointer dereference, e.g. when just parsing `'. --- webdump.c +++ webdump.c @@ -672,7 +672,8 @@ xmltagend(XMLParser *p, const char *t, size_t tl, int isshort) } /* if the current closing tag matches the current open tag */ - if (!strcasecmp(nodes[curnode].tag.name, t)) { + if (nodes[curnode].tag.name && + !strcasecmp(nodes[curnode].tag.name, t)) { tagend(&nodes[curnode]); if (curnode) curnode--; @@ -680,7 +681,8 @@ xmltagend(XMLParser *p, const char *t, size_t tl, int isshort) /* ... else lookup the first matching start tag. This is also for handling optional closing tags */ for (i = curnode; i > 0; i--) { - if (!strcasecmp(nodes[i].tag.name, t)) { + if (nodes[curnode].tag.name && + !strcasecmp(nodes[i].tag.name, t)) { tagend(&nodes[i]); curnode = i; break;