Skip to content

Commit

Permalink
fix: problem with not closed tag (#262)
Browse files Browse the repository at this point in the history
  • Loading branch information
slawiko authored Aug 16, 2022
1 parent c2419c4 commit 72844dd
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions dist/xss.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -621,7 +621,7 @@ function parseTag(html, onTag, escapeHtml) {
}
}
}
if (lastPos < html.length) {
if (lastPos < len) {
rethtml += escapeHtml(html.substr(lastPos));
}

Expand Down
Loading

0 comments on commit 72844dd

Please sign in to comment.