diff --git a/lib/buffer.js b/lib/buffer.js index 061ff7ebe440da..7902fc6fde5dcc 100644 --- a/lib/buffer.js +++ b/lib/buffer.js @@ -276,7 +276,7 @@ function assertSize(size) { */ Buffer.alloc = function alloc(size, fill, encoding) { assertSize(size); - if (fill !== undefined && size > 0) { + if (fill !== undefined && fill !== 0 && size > 0) { return _fill(createUnsafeBuffer(size), fill, encoding); } return new FastBuffer(size);