diff --git a/lib/buffer.js b/lib/buffer.js index eff91be2882630..dd08c9a13f38f1 100644 --- a/lib/buffer.js +++ b/lib/buffer.js @@ -79,8 +79,8 @@ Object.setPrototypeOf(SlowBuffer, Uint8Array); function allocate(size) { - if (size === 0) { - return createBuffer(size); + if (size <= 0) { + return createBuffer(0); } if (size < (Buffer.poolSize >>> 1)) { if (size > (poolSize - poolOffset))