Skip to content

Commit 1e21d05

Browse files
committed
buffer: avoid use of arguments
Avoid use of arguments in Buffer.prototype.toString() PR-URL: #11358 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
1 parent 797ec33 commit 1e21d05

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/buffer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -503,12 +503,12 @@ Buffer.prototype.copy = function(target, targetStart, sourceStart, sourceEnd) {
503503
return binding.copy(this, target, targetStart, sourceStart, sourceEnd);
504504
};
505505

506-
Buffer.prototype.toString = function() {
506+
Buffer.prototype.toString = function(encoding, start, end) {
507507
let result;
508508
if (arguments.length === 0) {
509509
result = this.utf8Slice(0, this.length);
510510
} else {
511-
result = slowToString.apply(this, arguments);
511+
result = slowToString.call(this, encoding, start, end);
512512
}
513513
if (result === undefined)
514514
throw new Error('"toString()" failed');

0 commit comments

Comments
 (0)