fix: problem with not closed tag (#262)

This commit is contained in:
Sviataslau Shchaurouski
2022-08-16 15:50:26 +02:00
committed by GitHub
parent c2419c4d14
commit 72844ddc6f
4 changed files with 6 additions and 5 deletions

4
dist/xss.js vendored
View File

@@ -586,7 +586,7 @@ function parseTag(html, onTag, escapeHtml) {
lastPos = currentPos;
continue;
}
if (c === ">") {
if (c === ">" || currentPos === len - 1) {
rethtml += escapeHtml(html.slice(lastPos, tagStart));
currentHtml = html.slice(tagStart, currentPos + 1);
currentTagName = getTagName(currentHtml);
@@ -621,7 +621,7 @@ function parseTag(html, onTag, escapeHtml) {
}
}
}
if (lastPos < html.length) {
if (lastPos < len) {
rethtml += escapeHtml(html.substr(lastPos));
}