diff options
author | cjihrig <cjihrig@gmail.com> | 2018-05-19 21:09:45 -0400 |
---|---|---|
committer | cjihrig <cjihrig@gmail.com> | 2018-05-19 22:24:06 -0400 |
commit | 1ae184a85c05164b40933a5efc678cd9f008d2c4 (patch) | |
tree | 767257605289f3d55a598cb66005ffc10ef17176 /lib/fs.js | |
parent | 1c1b8ae409368adee82ebe4edc090db570d21764 (diff) | |
download | node-new-1ae184a85c05164b40933a5efc678cd9f008d2c4.tar.gz |
fs: improve fchmod{Sync} validation
This commit validates the fd parameters to fs.fchmod{Sync} as
int32s instead of uint32s because they are ints in the binding
layer.
PR-URL: https://github.com/nodejs/node/pull/20588
Fixes: https://github.com/nodejs/node/issues/20498
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Weijia Wang <starkwang@126.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'lib/fs.js')
-rw-r--r-- | lib/fs.js | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1057,7 +1057,7 @@ fs.unlinkSync = function(path) { }; fs.fchmod = function(fd, mode, callback) { - validateUint32(fd, 'fd'); + validateInt32(fd, 'fd', 0); mode = validateAndMaskMode(mode, 'mode'); callback = makeCallback(callback); @@ -1067,7 +1067,7 @@ fs.fchmod = function(fd, mode, callback) { }; fs.fchmodSync = function(fd, mode) { - validateUint32(fd, 'fd'); + validateInt32(fd, 'fd', 0); mode = validateAndMaskMode(mode, 'mode'); const ctx = {}; binding.fchmod(fd, mode, undefined, ctx); |