Skip to content

Commit

Permalink
fs: harden fs.read(params, callback) typecheck
Browse files Browse the repository at this point in the history
PR-URL: #42772
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
LiviaMedeiros authored and nodejs-github-bot committed Sep 11, 2022
1 parent 29953a0 commit 2275faa
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 @@ -639,6 +639,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 2275faa

Please sign in to comment.