From f9c410a85307b073e3505dfe0dc308f79048d38c 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 3f47677dd56469..6ca079223723fc 100644 --- a/lib/buffer.js +++ b/lib/buffer.js @@ -493,12 +493,12 @@ function slowToString(encoding, start, end) { } -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');