From 1e21d05632fe75322f158df984df80c44132bcdb Mon Sep 17 00:00:00 2001 From: James M Snell Date: Mon, 13 Feb 2017 14:14:42 -0800 Subject: [PATCH] buffer: avoid use of arguments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Avoid use of arguments in Buffer.prototype.toString() PR-URL: https://github.com/nodejs/node/pull/11358 Reviewed-By: Colin Ihrig Reviewed-By: Сковорода Никита Андреевич Reviewed-By: Luigi Pinca Reviewed-By: Joyee Cheung Reviewed-By: Anna Henningsen --- lib/buffer.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/buffer.js b/lib/buffer.js index 5d42f362e71..fcebe95b0b0 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');