diff -u libxml2-2.7.8.dfsg/HTMLparser.c libxml2-2.7.8.dfsg/HTMLparser.c --- libxml2-2.7.8.dfsg/HTMLparser.c +++ libxml2-2.7.8.dfsg/HTMLparser.c @@ -3194,12 +3194,17 @@ ctxt->instate = state; return; } + len = 0; + buf[len] = 0; q = CUR_CHAR(ql); + if (!IS_CHAR(q)) + goto unfinished; NEXTL(ql); r = CUR_CHAR(rl); + if (!IS_CHAR(r)) + goto unfinished; NEXTL(rl); cur = CUR_CHAR(l); - len = 0; while (IS_CHAR(cur) && ((cur != '>') || (r != '-') || (q != '-'))) { @@ -3230,18 +3235,20 @@ } } buf[len] = 0; - if (!IS_CHAR(cur)) { - htmlParseErr(ctxt, XML_ERR_COMMENT_NOT_FINISHED, - "Comment not terminated \n