mirror of
https://gitlab.gnome.org/GNOME/libxml2
synced 2025-03-28 21:33:13 +00:00
fixed an UTF-8 parsing bug reported by Markus Bertheau on #fedora-devel
* xpath.c: fixed an UTF-8 parsing bug reported by Markus Bertheau on #fedora-devel Daniel
This commit is contained in:
parent
acbe6cfd96
commit
032268145f
@ -1,3 +1,8 @@
|
||||
Mon Nov 1 15:54:18 CET 2004 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* xpath.c: fixed an UTF-8 parsing bug reported by Markus Bertheau
|
||||
on #fedora-devel
|
||||
|
||||
Sun Oct 31 22:03:38 CET 2004 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* parser.c: fixed a bug reported by Petr Pajas on the list and
|
||||
|
47
xpath.c
47
xpath.c
@ -8012,35 +8012,34 @@ xmlXPathCompFilterExpr(xmlXPathParserContextPtr ctxt) {
|
||||
|
||||
static xmlChar *
|
||||
xmlXPathScanName(xmlXPathParserContextPtr ctxt) {
|
||||
xmlChar buf[XML_MAX_NAMELEN];
|
||||
int len = 0;
|
||||
int len = 0, l;
|
||||
int c;
|
||||
int count = 0;
|
||||
const xmlChar *cur;
|
||||
xmlChar *ret;
|
||||
|
||||
SKIP_BLANKS;
|
||||
if (!IS_ASCII_LETTER(CUR) && (CUR != '_') &&
|
||||
(CUR != ':')) {
|
||||
cur = ctxt->cur;
|
||||
|
||||
c = CUR_CHAR(l);
|
||||
if ((c == ' ') || (c == '>') || (c == '/') || /* accelerators */
|
||||
(!IS_LETTER(c) && (c != '_') &&
|
||||
(c != ':'))) {
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
while ((IS_ASCII_LETTER(NXT(len))) || (IS_ASCII_DIGIT(NXT(len))) ||
|
||||
(NXT(len) == '.') || (NXT(len) == '-') ||
|
||||
(NXT(len) == '_') || (NXT(len) == ':') ||
|
||||
(IS_COMBINING_CH(NXT(len))) ||
|
||||
(IS_EXTENDER_CH(NXT(len)))) {
|
||||
buf[len] = NXT(len);
|
||||
len++;
|
||||
if (len >= XML_MAX_NAMELEN) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlScanName: reached XML_MAX_NAMELEN limit\n");
|
||||
while ((IS_ASCII_LETTER(NXT(len))) || (IS_ASCII_DIGIT(NXT(len))) ||
|
||||
(NXT(len) == '.') || (NXT(len) == '-') ||
|
||||
(NXT(len) == '_') || (NXT(len) == ':') ||
|
||||
(IS_COMBINING_CH(NXT(len))) ||
|
||||
(IS_EXTENDER_CH(NXT(len))))
|
||||
len++;
|
||||
break;
|
||||
}
|
||||
while ((c != ' ') && (c != '>') && (c != '/') && /* test bigname.xml */
|
||||
((IS_LETTER(c)) || (IS_DIGIT(c)) ||
|
||||
(c == '.') || (c == '-') ||
|
||||
(c == '_') || (c == ':') ||
|
||||
(IS_COMBINING(c)) ||
|
||||
(IS_EXTENDER(c)))) {
|
||||
len += l;
|
||||
NEXTL(l);
|
||||
c = CUR_CHAR(l);
|
||||
}
|
||||
return(xmlStrndup(buf, len));
|
||||
ret = xmlStrndup(cur, ctxt->cur - cur);
|
||||
ctxt->cur = cur;
|
||||
return(ret);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user