diff options
author | Daniel Veillard <veillard@src.gnome.org> | 2004-10-26 21:53:55 +0000 |
---|---|---|
committer | Daniel Veillard <veillard@src.gnome.org> | 2004-10-26 21:53:55 +0000 |
commit | 95ddcd326694de324a41a73d407d72604dd746d1 (patch) | |
tree | e11a747dddd3f452dd28eb9d18b150adb6ceb419 | |
parent | 03a53c34db279cbe4a305d58969beb1f26ff3d19 (diff) | |
download | libxml2-95ddcd326694de324a41a73d407d72604dd746d1.tar.gz |
applied fixes for a couple of potential security problems more fixes on
* nanoftp.c: applied fixes for a couple of potential security problems
* tree.c valid.c xmllint.c: more fixes on the string interning checks
Daniel
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | nanoftp.c | 15 | ||||
-rw-r--r-- | tree.c | 4 | ||||
-rw-r--r-- | valid.c | 3 | ||||
-rw-r--r-- | xmllint.c | 2 |
5 files changed, 22 insertions, 7 deletions
@@ -1,3 +1,8 @@ +Tue Oct 26 23:57:02 CEST 2004 Daniel Veillard <daniel@veillard.com> + + * nanoftp.c: applied fixes for a couple of potential security problems + * tree.c valid.c xmllint.c: more fixes on the string interning checks + Tue Oct 26 18:09:59 CEST 2004 Daniel Veillard <daniel@veillard.com> * debugXML.c include/libxml/xmlerror.h: added checking for names @@ -355,8 +355,13 @@ xmlNanoFTPScanURL(void *ctx, const char *URL) { if (cur[0] == '[') { cur++; - while (cur[0] != ']') + while ((cur[0] != ']') && (indx < XML_NANO_MAX_URLBUF-1)) buf[indx++] = *cur++; + if (indx >= XML_NANO_MAX_URLBUF-1) { + xmlGenericError(xmlGenericErrorContext, + "\nxmlNanoFTPScanURL: %s", "Syntax Error\n"); + return; + } if (!strchr (buf, ':')) { xmlGenericError (xmlGenericErrorContext, "\nxmlNanoFTPScanURL: %s", @@ -604,8 +609,14 @@ xmlNanoFTPScanProxy(const char *URL) { if (cur[0] == '[') { cur++; - while (cur[0] != ']') + while ((cur[0] != ']') && (indx < XML_NANO_MAX_URLBUF-1)) buf[indx++] = *cur++; + if (indx >= XML_NANO_MAX_URLBUF-1) { + xmlGenericError (xmlGenericErrorContext, + "\nxmlNanoFTPScanProxy: %s", "Syntax error\n"); + return; + } + if (!strchr (buf, ':')) { xmlGenericError (xmlGenericErrorContext, "\nxmlNanoFTPScanProxy: %s", "Use [IPv6]/IPv4 format\n"); @@ -2270,7 +2270,7 @@ xmlNewDocNode(xmlDocPtr doc, xmlNsPtr ns, const xmlChar *name, const xmlChar *content) { xmlNodePtr cur; - if (doc->dict != NULL) + if ((doc != NULL) && (doc->dict != NULL)) cur = xmlNewNodeEatName(ns, (xmlChar *) xmlDictLookup(doc->dict, name, -1)); else @@ -2336,7 +2336,7 @@ xmlNewDocRawNode(xmlDocPtr doc, xmlNsPtr ns, const xmlChar *name, const xmlChar *content) { xmlNodePtr cur; - cur = xmlNewNode(ns, name); + cur = xmlNewDocNode(doc, ns, name, NULL); if (cur != NULL) { cur->doc = doc; if (content != NULL) { @@ -6697,8 +6697,7 @@ xmlValidGetValidElements(xmlNode *prev, xmlNode *next, const xmlChar **names, /* * Creates a dummy node and insert it into the tree */ - test_node = xmlNewNode (NULL, BAD_CAST "<!dummy?>"); - test_node->doc = ref_node->doc; + test_node = xmlNewDocNode (ref_node->doc, NULL, BAD_CAST "<!dummy?>", NULL); test_node->parent = parent; test_node->prev = prev; test_node->next = next; @@ -1005,7 +1005,7 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) { xmlNodePtr n; doc = xmlNewDoc(BAD_CAST "1.0"); - n = xmlNewNode(NULL, BAD_CAST "info"); + n = xmlNewDocNode(doc, NULL, BAD_CAST "info", NULL); xmlNodeSetContent(n, BAD_CAST "abc"); xmlDocSetRootElement(doc, n); } |