From ade54a345eff35665c4c946e65e798f4d82136aa Mon Sep 17 00:00:00 2001 From: rswindell <> Date: Tue, 9 Jan 2018 06:44:14 +0000 Subject: [PATCH] Use truncsp() for extra embedded-null protection: JS String.trim() does not treat NULs as white-space. --- exec/load/sauce_lib.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/exec/load/sauce_lib.js b/exec/load/sauce_lib.js index ac19a8c1b7..58b6a48917 100644 --- a/exec/load/sauce_lib.js +++ b/exec/load/sauce_lib.js @@ -67,10 +67,10 @@ function read(fname) return false; var obj = { comment:[], cols:0, rows:0, ice_color:false }; - obj.title = file.read(35).trim(); - obj.author = file.read(20).trim(); - obj.group = file.read(20).trim(); - obj.date = file.read(8).trim(); + obj.title = truncsp(file.read(35)); + obj.author = truncsp(file.read(20)); + obj.group = truncsp(file.read(20)); + obj.date = truncsp(file.read(8)); obj.filesize = file.readBin(4); obj.datatype = file.readBin(1); obj.filetype = file.readBin(1); @@ -105,7 +105,7 @@ function read(fname) while(comments--) { var line = file.read(defs.comment_length); if(line) - obj.comment.push(line.trimRight()); + obj.comment.push(truncsp(line)); } } } -- GitLab