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
diff --git a/catalog.c b/catalog.c
index 95ebee8..ee3f8f2 100644
--- a/catalog.c
+++ b/catalog.c
@@ -1828,6 +1828,8 @@
if (ret != NULL) {
catal->depth--;
return(ret);
+ } else if (catal->depth > MAX_CATAL_DEPTH) {
+ return(NULL);
}
}
}
@@ -1868,6 +1870,13 @@
if (URI == 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.
*/
@@ -2053,16 +2062,18 @@
if (catal->children != NULL) {
ret = xmlCatalogXMLResolve(catal->children, pubID, sysID);
if (ret != NULL) {
- if (normid != NULL)
- xmlFree(normid);
- return(ret);
- }
+ break;
+ } else if ((catal->children != NULL) &&
+ (catal->children->depth > MAX_CATAL_DEPTH)) {
+ ret = NULL;
+ break;
+ }
}
}
catal = catal->next;
}
- if (normid != NULL)
- xmlFree(normid);
+ if (normid != NULL)
+ xmlFree(normid);
return(ret);
}