From e0528fc2d4336bfa348a67a5a330b1d96daddd35 Mon Sep 17 00:00:00 2001 From: ehofman <ehofman> Date: Mon, 27 Apr 2009 09:45:59 +0000 Subject: [PATCH] catch one more syntax error and remove a stale debug printf --- utils/xmlgrep/xml.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/utils/xmlgrep/xml.c b/utils/xmlgrep/xml.c index a5e85e810..108942338 100644 --- a/utils/xmlgrep/xml.c +++ b/utils/xmlgrep/xml.c @@ -1547,6 +1547,14 @@ __xmlNodeGet(const char *start, size_t *len, char **name, size_t *rlen, size_t * { if (!strncasecmp(new+1, element, elementlen)) { + if (*(new+elementlen+1) != '>') + { + *rlen = 0; + *name = new+1; + *len = XML_ELEMENT_NO_CLOSING_TAG; + return 0; + } + if (found == num) { if (start_tag) @@ -1564,7 +1572,9 @@ __xmlNodeGet(const char *start, size_t *len, char **name, size_t *rlen, size_t * } found++; } - /* else proper closing tag not yet found, continue */ + /* else proper closing tag not yet found, continue. */ + /* TODO: could be a bad match to the opening tag though */ + /* like: <test></teft> */ new = memchr(cur, '>', restlen); if (!new) @@ -1583,7 +1593,6 @@ __xmlNodeGet(const char *start, size_t *len, char **name, size_t *rlen, size_t * *rlen = 0; *name = cur; *len = XML_ELEMENT_NO_CLOSING_TAG; -printf("4\n"); return 0; } }