--- libxml2-2.5.11/include/libxml/parserInternals.h 2003-10-07 10:45:15.000000000 -0500 +++ libxml2-2.5.11.xmlParserMaxDepth/include/libxml/parserInternals.h 2003-10-15 14:54:33.000000000 -0500 @@ -17,6 +17,15 @@ extern "C" { #endif +/** + * xmlParserMaxDepth: + * + * arbitrary depth limit for the XML documents that we allow to + * process. This is not a limitation of the parser but a safety + * boundary feature. + */ +extern unsigned int xmlParserMaxDepth; + /** * XML_MAX_NAMELEN: * --- libxml2-2.5.11/parser.c 2003-10-07 10:45:15.000000000 -0500 +++ libxml2-2.5.11.xmlParserMaxDepth/parser.c 2003-10-15 14:51:04.000000000 -0500 @@ -77,13 +77,13 @@ #endif /** - * MAX_DEPTH: + * xmlParserMaxDepth: * * arbitrary depth limit for the XML documents that we allow to * process. This is not a limitation of the parser but a safety * boundary feature. */ -#define MAX_DEPTH 1024 +unsigned int xmlParserMaxDepth = 1024; #define XML_PARSER_BIG_BUFFER_SIZE 300 #define XML_PARSER_BUFFER_SIZE 100 @@ -199,18 +199,16 @@ return (0); } } -#ifdef MAX_DEPTH - if (ctxt->nodeNr > MAX_DEPTH) { + if (ctxt->nodeNr > xmlParserMaxDepth) { if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, - "Excessive depth in document: change MAX_DEPTH = %d\n", - MAX_DEPTH); + "Excessive depth in document: change xmlParserMaxDepth = %d\n", + xmlParserMaxDepth); ctxt->wellFormed = 0; ctxt->instate = XML_PARSER_EOF; if (ctxt->recovery == 0) ctxt->disableSAX = 1; return(0); } -#endif ctxt->nodeTab[ctxt->nodeNr] = value; ctxt->node = value; return (ctxt->nodeNr++);