diff --git a/lib/buffer.js b/lib/buffer.js index 5d42f362e71007..fcebe95b0b0647 100644 --- a/lib/buffer.js +++ b/lib/buffer.js @@ -503,12 +503,12 @@ Buffer.prototype.copy = function(target, targetStart, sourceStart, sourceEnd) { return binding.copy(this, target, targetStart, sourceStart, sourceEnd); }; -Buffer.prototype.toString = function() { +Buffer.prototype.toString = function(encoding, start, end) { let result; if (arguments.length === 0) { result = this.utf8Slice(0, this.length); } else { - result = slowToString.apply(this, arguments); + result = slowToString.call(this, encoding, start, end); } if (result === undefined) throw new Error('"toString()" failed');