Skip to content

Commit

Permalink
Merge pull request #9 from mhart/fix-buffer-constructor-vuln
Browse files Browse the repository at this point in the history
Ensure data is not a number in Buffer constructor
  • Loading branch information
mhart authored May 17, 2018
2 parents 1efe3bf + afbc744 commit 2f4a9d4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion stringstream.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ StringStream.prototype.write = function(data) {
return false
}
if (this.fromEncoding) {
if (Buffer.isBuffer(data)) data = data.toString()
if (Buffer.isBuffer(data) || typeof data === 'number') data = data.toString()
data = new Buffer(data, this.fromEncoding)
}
var string = this.decoder.write(data)
Expand Down

0 comments on commit 2f4a9d4

Please sign in to comment.