summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-01-09 11:18:38 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2015-01-09 11:20:45 -0800
commit4b52529eb964fd1e949ae60e2da70ac3a0db6a9c (patch)
tree6c281f1df868260ccec5899abc1af92063f7cb00 /js
parent98ad06a6d1ff2bbba75110dbe46e5c28cae966dd (diff)
JS: replace NUL characters with U+FFFD, as per spec.
Diffstat (limited to 'js')
-rw-r--r--js/lib/blocks.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/js/lib/blocks.js b/js/lib/blocks.js
index 1e20d29..8f4776c 100644
--- a/js/lib/blocks.js
+++ b/js/lib/blocks.js
@@ -16,6 +16,10 @@ var isBlank = function(s) {
// Convert tabs to spaces on each line using a 4-space tab stop.
var detabLine = function(text) {
"use strict";
+ if (text.indexOf('\0') !== -1) {
+ // replace NUL for security
+ text = text.replace(/\0/g, '\uFFFD');
+ }
if (text.indexOf('\t') === -1) {
return text;
} else {