From: Feross Aboukhadijeh Date: Fri, 16 Feb 2018 08:58:28 +0000 (-0800) Subject: Buffer.isBuffer(Buffer.prototype) should be false X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=e104540471509f547301591b9842eaede341b952;p=buffer.git Buffer.isBuffer(Buffer.prototype) should be false --- diff --git a/index.js b/index.js index f47a36a..4acc3d1 100644 --- a/index.js +++ b/index.js @@ -329,7 +329,8 @@ function SlowBuffer (length) { } Buffer.isBuffer = function isBuffer (b) { - return b != null && b._isBuffer === true + return b != null && b._isBuffer === true && + b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false } Buffer.compare = function compare (a, b) {