mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2024-12-14 10:24:32 -05:00
363b0ad58a
Signed-off-by: Tavi <tavi@divested.dev>
47 lines
1.5 KiB
Diff
47 lines
1.5 KiB
Diff
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
|
|
index ec62f140..145c283b 100644
|
|
--- 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
|
|
index 57c93e05..9df42782 100644
|
|
--- 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)
|