summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSakthipriyan Vairamani (thefourtheye) <thechargingvolcano@gmail.com>2018-01-17 12:22:59 +0530
committerRuben Bridgewater <ruben@bridgewater.de>2018-01-19 13:06:56 +0100
commit2a61ce5996cb0de47ea985b3c1da199872f36ddb (patch)
tree9a039f38c0b28f0c0075cb7b8431d388b2fe53ce /src
parent11a26e1b2e49c2b72ed0510d16b00722edcd0b0c (diff)
downloadandroid-node-v8-2a61ce5996cb0de47ea985b3c1da199872f36ddb.tar.gz
android-node-v8-2a61ce5996cb0de47ea985b3c1da199872f36ddb.tar.bz2
android-node-v8-2a61ce5996cb0de47ea985b3c1da199872f36ddb.zip
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>
Diffstat (limited to 'src')
-rw-r--r--src/node_file.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/node_file.cc b/src/node_file.cc
index 30bc4e1f38..3edf09b647 100644
--- a/src/node_file.cc
+++ b/src/node_file.cc
@@ -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);
}