[xml] patch for SAX.c
- From: Anthony Jones <amj30 cam ac uk>
- To: xml gnome org
- Subject: [xml] patch for SAX.c
- Date: Sun, 20 Jan 2002 20:35:52 +0000
In the function startElement() we use a fixed length buffer when checking
that attributes are not declared. Unless I'm missing something, I think we
should really use a dynamically allocated buffer, so we don't get problems
in the unlikely event that strlen(prefix) + strlen(":") + strlen(name) >
99. Doing it this way also means we stick with using the xmlStr functions,
which is nicer than using snprintf() IMHO...
Anthony
--- SAX.c 2001/12/31 16:15:57 1.82
+++ SAX.c 2002/01/20 20:07:44
@@ -1062,14 +1062,14 @@
((attr->prefix == NULL) &&
(xmlStrEqual(attr->name, BAD_CAST "xmlns"))) ||
(ctxt->loadsubset & XML_COMPLETE_ATTRS)) {
- xmlChar buffer[100];
- const xmlChar *fulln = attr->name;
+ xmlChar *fulln;
if (attr->prefix != NULL) {
- snprintf((char *) buffer, 99, "%s:%s",
- attr->prefix, attr->name);
- buffer[99] = 0;
- fulln = buffer;
+ fulln = xmlStrdup(attr->prefix);
+ fulln = xmlStrcat(fulln, BAD_CAST ":");
+ fulln = xmlStrcat(fulln, attr->name);
+ } else {
+ fulln = xmlStrdup(attr->name);
}
/*
@@ -1089,6 +1089,7 @@
}
if (att == NULL)
attribute(ctxt, fulln, attr->defaultValue);
+ xmlFree(fulln);
}
}
attr = attr->nexth;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]