Skip to content

Commit 6556f9e

Browse files
committed
Disable loading of external DTDs or entities
1 parent 56f5ca0 commit 6556f9e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

ext/solv_xmlparser.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,12 +252,17 @@ free_parser(struct solv_xmlparser *xmlp)
252252
static xmlParserCtxtPtr
253253
create_parser_ctx(struct solv_xmlparser *xmlp, char *buf, int l)
254254
{
255+
xmlParserCtxtPtr parser;
255256
xmlSAXHandler sax;
256257
memset(&sax, 0, sizeof(sax));
257258
sax.startElement = start_element;
258259
sax.endElement = end_element;
259260
sax.characters = character_data;
260-
return xmlCreatePushParserCtxt(&sax, xmlp, buf, l, NULL);
261+
parser = xmlCreatePushParserCtxt(&sax, xmlp, buf, l, NULL);
262+
if (parser) {
263+
xmlCtxtSetOptions(parser, XML_PARSE_NO_XXE);
264+
}
265+
return parser;
261266
}
262267

263268
static inline int

0 commit comments

Comments
 (0)