Skip to content

Commit

Permalink
Prevent original message buffer from being modified
Browse files Browse the repository at this point in the history
  • Loading branch information
smfreegard committed Nov 28, 2013
1 parent e520a33 commit ef21d71
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions messagestream.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,8 @@ MessageStream.prototype.process_buf = function (buf) {
if (this.line_endings === '\n' && line.length >= 2 &&
line[line.length-1] === 0x0a && line[line.length-2] === 0x0d)
{
// We copy the line to a new buffer before modifying the copy
line = new Buffer(line);
line[line.length-2] = 0x0a;
line = line.slice(0, line.length-1);
}
Expand Down

0 comments on commit ef21d71

Please sign in to comment.