summaryrefslogtreecommitdiff
path: root/parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'parser.c')
-rw-r--r--parser.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/parser.c b/parser.c
index e415339..b41dcc3 100644
--- a/parser.c
+++ b/parser.c
@@ -10130,8 +10130,12 @@ xmlParseDocument(xmlParserCtxtPtr ctxt) {
/*
* Check for the XMLDecl in the Prolog.
* do not GROW here to avoid the detected encoder to decode more
- * than just the first line
+ * than just the first line, unless the amount of data is really
+ * too small to hold "<?xml version="1.0" encoding="foo"
*/
+ if ((ctxt->input->end - ctxt->input->cur) < 35) {
+ GROW;
+ }
if ((CMP5(CUR_PTR, '<', '?', 'x', 'm', 'l')) && (IS_BLANK_CH(NXT(5)))) {
/*