2024-09-08 09:31:43 -04:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Rhodri James <rhodri@kynesim.co.uk>
|
|
|
|
Date: Tue, 25 Apr 2017 16:21:27 +0100
|
|
|
|
Subject: [PATCH] Validate parser parameter to XML_UseForeignDTD.
|
|
|
|
|
|
|
|
---
|
|
|
|
lib/expat.h | 5 ++++-
|
|
|
|
lib/xmlparse.c | 2 ++
|
|
|
|
2 files changed, 6 insertions(+), 1 deletion(-)
|
|
|
|
|
|
|
|
diff --git a/lib/expat.h b/lib/expat.h
|
2024-09-15 16:56:21 -04:00
|
|
|
index 086e24b3..957da1c5 100644
|
2024-09-08 09:31:43 -04:00
|
|
|
--- a/lib/expat.h
|
|
|
|
+++ b/lib/expat.h
|
|
|
|
@@ -95,7 +95,9 @@ enum XML_Error {
|
|
|
|
/* Added in 2.0. */
|
|
|
|
XML_ERROR_RESERVED_PREFIX_XML,
|
|
|
|
XML_ERROR_RESERVED_PREFIX_XMLNS,
|
|
|
|
- XML_ERROR_RESERVED_NAMESPACE_URI
|
|
|
|
+ XML_ERROR_RESERVED_NAMESPACE_URI,
|
|
|
|
+ /* Added in 2.2 */
|
|
|
|
+ XML_ERROR_INVALID_ARGUMENT
|
|
|
|
};
|
|
|
|
|
|
|
|
enum XML_Content_Type {
|
|
|
|
@@ -706,6 +708,7 @@ XML_UseParserAsHandlerArg(XML_Parser parser);
|
|
|
|
be called, despite an external subset being parsed.
|
|
|
|
Note: If XML_DTD is not defined when Expat is compiled, returns
|
|
|
|
XML_ERROR_FEATURE_REQUIRES_XML_DTD.
|
|
|
|
+ Note: If parser == NULL, returns XML_ERROR_INVALID_ARGUMENT.
|
|
|
|
*/
|
|
|
|
XMLPARSEAPI(enum XML_Error)
|
|
|
|
XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD);
|
|
|
|
diff --git a/lib/xmlparse.c b/lib/xmlparse.c
|
2024-09-15 16:56:21 -04:00
|
|
|
index ee71adad..065b04f8 100644
|
2024-09-08 09:31:43 -04:00
|
|
|
--- a/lib/xmlparse.c
|
|
|
|
+++ b/lib/xmlparse.c
|
|
|
|
@@ -1243,6 +1243,8 @@ XML_UseParserAsHandlerArg(XML_Parser parser)
|
|
|
|
enum XML_Error XMLCALL
|
|
|
|
XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD)
|
|
|
|
{
|
|
|
|
+ if (parser == NULL)
|
|
|
|
+ return XML_ERROR_INVALID_ARGUMENT;
|
|
|
|
#ifdef XML_DTD
|
|
|
|
/* block after XML_Parse()/XML_ParseBuffer() has been called */
|
|
|
|
if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED)
|