xplist: Prevent OOB read in two more cases
diff --git a/src/xplist.c b/src/xplist.c
index 7cee6de..d157200 100644
--- a/src/xplist.c
+++ b/src/xplist.c
@@ -546,6 +546,11 @@
}
if (*ctx->pos == '!') {
ctx->pos++;
+ if (ctx->pos >= ctx->end-1) {
+ PLIST_XML_ERR("EOF while parsing <! special tag\n");
+ ctx->err++;
+ return NULL;
+ }
if (*ctx->pos == '-' && *(ctx->pos+1) == '-') {
if (last) {
last = text_part_append(last, p, q-p, 0);
@@ -844,6 +849,11 @@
ctx->pos+=8;
while (ctx->pos < ctx->end) {
find_next(ctx, " \t\r\n[>", 6, 1);
+ if (ctx->pos >= ctx->end) {
+ PLIST_XML_ERR("EOF while parsing !DOCTYPE\n");
+ ctx->err++;
+ goto err_out;
+ }
if (*ctx->pos == '[') {
embedded_dtd = 1;
break;