diff options
author | Joyee Cheung <joyeec9h3@gmail.com> | 2017-12-25 05:00:24 +0800 |
---|---|---|
committer | Anatoli Papirovski <apapirovski@mac.com> | 2017-12-27 12:47:35 -0500 |
commit | 9ec700b073894ad54432db4c4b540e2b61b45325 (patch) | |
tree | 58335a78b8c5518a161715ab8aa2ef547042c3e7 /lib | |
parent | 03b8ac14e7cb535fc7a82188c666b5a2a38d00bc (diff) | |
download | android-node-v8-9ec700b073894ad54432db4c4b540e2b61b45325.tar.gz android-node-v8-9ec700b073894ad54432db4c4b540e2b61b45325.tar.bz2 android-node-v8-9ec700b073894ad54432db4c4b540e2b61b45325.zip |
fs: validate path in fs.readFile
PR-URL: https://github.com/nodejs/node/pull/17852
Refs: https://github.com/nodejs/node/pull/17667
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/fs.js | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -389,6 +389,9 @@ fs.readFile = function(path, options, callback) { req.oncomplete(null, path); }); return; + } else if (typeof path !== 'string' && !(path instanceof Buffer)) { + throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'path', + ['string', 'Buffer', 'URL']); } binding.open(pathModule.toNamespacedPath(path), |