1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-12-27 03:21:26 +03:00

fixed bug #383687, some case of recursion on next were not caught in the

* catalog.c: fixed bug #383687, some case of recursion on next
  were not caught in the catalog code.
Daniel

svn path=/trunk/; revision=3628
This commit is contained in:
Daniel Veillard 2007-06-12 09:14:11 +00:00
parent 861101d1fa
commit be8d9d33eb
2 changed files with 22 additions and 6 deletions

View File

@ -1,3 +1,8 @@
Tue Jun 12 11:12:50 CEST 2007 Daniel Veillard <daniel@veillard.com>
* catalog.c: fixed bug #383687, some case of recursion on next
were not caught in the catalog code.
Tue Jun 12 10:37:42 CEST 2007 Daniel Veillard <daniel@veillard.com> Tue Jun 12 10:37:42 CEST 2007 Daniel Veillard <daniel@veillard.com>
* HTMLparser.c: fixed bug #381877, avoid reading over the end * HTMLparser.c: fixed bug #381877, avoid reading over the end

View File

@ -1828,6 +1828,8 @@ xmlCatalogXMLResolve(xmlCatalogEntryPtr catal, const xmlChar *pubID,
if (ret != NULL) { if (ret != NULL) {
catal->depth--; catal->depth--;
return(ret); return(ret);
} else if (catal->depth > MAX_CATAL_DEPTH) {
return(NULL);
} }
} }
} }
@ -1868,6 +1870,13 @@ xmlCatalogXMLResolveURI(xmlCatalogEntryPtr catal, const xmlChar *URI) {
if (URI == NULL) if (URI == NULL)
return(NULL); return(NULL);
if (catal->depth > MAX_CATAL_DEPTH) {
xmlCatalogErr(catal, NULL, XML_CATALOG_RECURSION,
"Detected recursion in catalog %s\n",
catal->name, NULL, NULL);
return(NULL);
}
/* /*
* First tries steps 2/ 3/ 4/ if a system ID is provided. * First tries steps 2/ 3/ 4/ if a system ID is provided.
*/ */
@ -2053,16 +2062,18 @@ xmlCatalogListXMLResolve(xmlCatalogEntryPtr catal, const xmlChar *pubID,
if (catal->children != NULL) { if (catal->children != NULL) {
ret = xmlCatalogXMLResolve(catal->children, pubID, sysID); ret = xmlCatalogXMLResolve(catal->children, pubID, sysID);
if (ret != NULL) { if (ret != NULL) {
if (normid != NULL) break;
xmlFree(normid); } else if ((catal->children != NULL) &&
return(ret); (catal->children->depth > MAX_CATAL_DEPTH)) {
} ret = NULL;
break;
}
} }
} }
catal = catal->next; catal = catal->next;
} }
if (normid != NULL) if (normid != NULL)
xmlFree(normid); xmlFree(normid);
return(ret); return(ret);
} }