From 2a61ce5996cb0de47ea985b3c1da199872f36ddb Mon Sep 17 00:00:00 2001 From: "Sakthipriyan Vairamani (thefourtheye)" Date: Wed, 17 Jan 2018 12:22:59 +0530 Subject: [PATCH] src: validate args length in Access and Close MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a follow-up of https://github.com/nodejs/node/pull/17914. When Access and Close functions are called in Sync mode, the number of items in args is validated. These are the only two places in this file where this validation doesn't take place. PR-URL: https://github.com/nodejs/node/pull/18203 Reviewed-By: Benjamin Gruenbaum Reviewed-By: Joyee Cheung Reviewed-By: Daniel Bevenius Reviewed-By: Tobias Nießen Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- src/node_file.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/node_file.cc b/src/node_file.cc index 30bc4e1f380d63..3edf09b647935c 100644 --- a/src/node_file.cc +++ b/src/node_file.cc @@ -403,6 +403,7 @@ void Access(const FunctionCallbackInfo& args) { AsyncCall(env, args, "access", UTF8, AfterNoArgs, uv_fs_access, *path, mode); } else { // access(path, mode, undefined, ctx) + CHECK_EQ(args.Length(), 4); fs_req_wrap req_wrap; SyncCall(env, args[3], &req_wrap, "access", uv_fs_access, *path, mode); } @@ -424,6 +425,7 @@ void Close(const FunctionCallbackInfo& args) { AsyncCall(env, args, "close", UTF8, AfterNoArgs, uv_fs_close, fd); } else { // close(fd, undefined, ctx) + CHECK_EQ(args.Length(), 3); fs_req_wrap req_wrap; SyncCall(env, args[2], &req_wrap, "close", uv_fs_close, fd); }