@@ -165,14 +165,16 @@ BOOL acceptProlog; size_t lineNumber; BOOL lastCarriageReturn; BOOL finishedParsing; of_string_encoding_t encoding; + size_t depthLimit; } #ifdef OF_HAVE_PROPERTIES @property (assign) id delegate; +@property size_t depthLimit; #endif /*! * @brief Creates a new XML parser. * @@ -186,16 +188,34 @@ * @return The delegate that is used by the XML parser */ - (id )delegate; /*! - * @brief Sets the delegate the OFXMLParser should use. + * @brief Sets the delegate the XML parser should use. * * @param delegate The delegate to use */ - (void)setDelegate: (id )delegate; +/*! + * @brief Returns the depth limit for the XML parser. + * + * @return The depth limit for the XML parser + */ +- (size_t)depthLimit; + +/*! + * @brief Sets the depth limit for the XML parser. + * + * If the depth limit is exceeded, an OFMalformedXMLException is thrown. + * + * The default is 32. 0 means unlimited (insecure!). + * + * @param depthLimit The depth limit for the XML parser + */ +- (void)setDepthLimit: (size_t)depthLimit; + /*! * @brief Parses the specified buffer with the specified size. * * @param buffer The buffer to parse * @param length The length of the buffer