From 920c2d53de373e28a36c39c95de5011e6320c89a Mon Sep 17 00:00:00 2001 From: LiviaMedeiros Date: Mon, 18 Apr 2022 19:54:40 +0800 Subject: [PATCH] fs: harden fs.read(params, callback) typecheck --- lib/fs.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/fs.js b/lib/fs.js index 912ca0503d5a25..41b4f75d4c0b47 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -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,