Skip to content

Commit

Permalink
fs: harden fs.read(params, callback) typecheck
Browse files Browse the repository at this point in the history
  • Loading branch information
LiviaMedeiros committed May 18, 2022
1 parent 761c078 commit 920c2d5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,9 @@ function read(fd, buffer, offsetOrOptions, length, position, callback) {
buffer = Buffer.alloc(16384);
}

if (params !== undefined) {
validateObject(params, 'options', { nullable: true });
}
({
offset = 0,
length = buffer.byteLength - offset,
Expand Down

0 comments on commit 920c2d5

Please sign in to comment.