Skip to content

Commit

Permalink
fix: raise an error on ]]> in character data
Browse files Browse the repository at this point in the history
  • Loading branch information
lddubeau committed Jul 6, 2018
1 parent c007e39 commit 2964381
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/saxes.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,11 @@ class SAXParser {
}
}
}
this.textNode += chunk.substring(starti, i - 1);
const fragment = chunk.substring(starti, i - 1);
if (fragment.includes("]]>")) {
this.fail("The string \"]]>\" is disallowed in char data.");
}
this.textNode += fragment;
}
if (c === "<") {
this.state = S_OPEN_WAKA;
Expand Down Expand Up @@ -673,6 +677,9 @@ class SAXParser {
}
continue;
}
if (this.attribValue.includes("]]>")) {
this.fail("The string \"]]>\" is disallowed in char data.");
}
this.attribList.push([this.attribName, this.attribValue]);
this.attribName = this.attribValue = "";
this.q = "";
Expand Down Expand Up @@ -710,6 +717,9 @@ class SAXParser {
}
continue;
}
if (this.attribValue.includes("]]>")) {
this.fail("The string \"]]>\" is disallowed in char data.");
}
this.attribList.push([this.attribName, this.attribValue]);
this.attribName = this.attribValue = "";
if (c === ">") {
Expand Down

0 comments on commit 2964381

Please sign in to comment.