Skip to content

Commit

Permalink
src: validate args length in Access and Close
Browse files Browse the repository at this point in the history
This is a follow-up of #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: #18203
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
thefourtheye authored and BridgeAR committed Jan 19, 2018
1 parent 11a26e1 commit 2a61ce5
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/node_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ void Access(const FunctionCallbackInfo<Value>& 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);
}
Expand All @@ -424,6 +425,7 @@ void Close(const FunctionCallbackInfo<Value>& 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);
}
Expand Down

0 comments on commit 2a61ce5

Please sign in to comment.