Validate parser parameter to XML_SetParamentityParsing

This commit is contained in:
Rhodri James 2017-04-25 17:55:57 +01:00 committed by Sebastian Pipping
parent e5430d8a07
commit 2a6ed44fbc
2 changed files with 3 additions and 0 deletions

View file

@ -905,6 +905,7 @@ enum XML_ParamEntityParsing {
entities is requested; otherwise it will return non-zero.
Note: If XML_SetParamEntityParsing is called after XML_Parse or
XML_ParseBuffer, then it has no effect and will always return 0.
Note: If parser == NULL, the function will do nothing and return 0.
*/
XMLPARSEAPI(int)
XML_SetParamEntityParsing(XML_Parser parser,

View file

@ -1618,6 +1618,8 @@ int XMLCALL
XML_SetParamEntityParsing(XML_Parser parser,
enum XML_ParamEntityParsing peParsing)
{
if (parser == NULL)
return 0;
/* block after XML_Parse()/XML_ParseBuffer() has been called */
if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED)
return 0;