mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
fs: fix fs.read when passing null value
PR-URL: https://github.com/nodejs/node/pull/32479 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com>
This commit is contained in:
committed by
Anna Henningsen
parent
fb254d2a83
commit
defbc2ed82
10
lib/fs.js
10
lib/fs.js
@@ -484,10 +484,12 @@ function read(fd, buffer, offset, length, position, callback) {
|
||||
callback = offset;
|
||||
}
|
||||
|
||||
buffer = options.buffer || Buffer.alloc(16384);
|
||||
offset = options.offset || 0;
|
||||
length = options.length || buffer.length;
|
||||
position = options.position;
|
||||
({
|
||||
buffer = Buffer.alloc(16384),
|
||||
offset = 0,
|
||||
length = buffer.length,
|
||||
position
|
||||
} = options);
|
||||
}
|
||||
|
||||
validateBuffer(buffer);
|
||||
|
||||
Reference in New Issue
Block a user