src: validate args length in Access and Close

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 <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>
This commit is contained in:
Sakthipriyan Vairamani (thefourtheye) authored and Ruben Bridgewater committed 2018-01-19 13:06:56 +01:00
1 parent 11a26e1b2e
commit 2a61ce5996
1 file changed
+2
+2
View File
@@ -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);
}
@@ -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);
}