fs: ensure nullCheck() callback is a function
authorcjihrig <cjihrig@gmail.com>
Thu, 19 Feb 2015 04:10:15 +0000 (23:10 -0500)
committercjihrig <cjihrig@gmail.com>
Thu, 19 Feb 2015 16:26:18 +0000 (11:26 -0500)
commitecef87177ac44d0840ec001aad0921824a2a13ec
tree42cd01937257348c7c27061c2b238ddaebd8fb75
parented240f44f7afd35f4f1fadedac3b976782467300
fs: ensure nullCheck() callback is a function

Currently, nullCheck() will attempt to invoke any truthy value
as a function if the path argument contains a null character.
This commit validates that the callback is actually a function
before trying to invoke it. fs.access() was vulnerable to this
bug, as nullCheck() was called prior to type checking its
callback.

PR-URL: https://github.com/iojs/io.js/pull/887
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
lib/fs.js
test/parallel/test-fs-access.js
test/parallel/test-fs-null-bytes.js