From bb284f4453f308d55b75d75e5caee47f4d6f9552 Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Wed, 16 Oct 2002 18:02:47 +0000 Subject: [PATCH] fixed a XML Namespace compliance bug reported by Alexander Grimalovsky * parser.c: fixed a XML Namespace compliance bug reported by Alexander Grimalovsky Daniel --- ChangeLog | 5 +++++ parser.c | 21 ++++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 5d83ff0f..ff50ee25 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Wed Oct 16 20:01:46 CEST 2002 Daniel Veillard + + * parser.c: fixed a XML Namespace compliance bug reported by + Alexander Grimalovsky + Wed Oct 16 17:18:42 CEST 2002 Daniel Veillard * HTMLtree.c: fixed serialization of script and style when diff --git a/parser.c b/parser.c index 2c579543..f734a3c7 100644 --- a/parser.c +++ b/parser.c @@ -1688,11 +1688,30 @@ xmlSplitQName(xmlParserCtxtPtr ctxt, const xmlChar *name, xmlChar **prefix) { if (c == ':') { - c = *cur++; + c = *cur; if (c == 0) return(ret); *prefix = ret; len = 0; + /* + * Check that the first character is proper to start + * a new name + */ + if (!(((c >= 0x61) && (c <= 0x7A)) || + ((c >= 0x41) && (c <= 0x5A)) || + (c == '_') || (c == ':'))) { + int l; + int first = CUR_SCHAR(cur, l); + + if (!IS_LETTER(first) && (first != '_')) { + if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) + ctxt->sax->error(ctxt->userData, + "Name %s is not XML Namespace compliant\n", + name); + } + } + cur++; + while ((c != 0) && (len < max)) { /* tested bigname2.xml */ buf[len++] = c; c = *cur++;