src: ensure that file descriptors 0-2 are valid
authorBen Noordhuis <info@bnoordhuis.nl>
Wed, 18 Feb 2015 02:43:29 +0000 (03:43 +0100)
committerBen Noordhuis <info@bnoordhuis.nl>
Wed, 18 Feb 2015 14:15:14 +0000 (15:15 +0100)
commitb5f25a963cada60ada3230124585ad1fc9a1ad7a
treee2e13b38009612eef79a9a976cf5664033d9921d
parenta956791f6995f9cfbeb21ffcf129125665bed298
src: ensure that file descriptors 0-2 are valid

Check that stdin, stdout and stderr map to open file descriptors and
remap them to /dev/null if that isn't the case.  Protects against
information leaks or worse when io.js is started with closed stdio
file descriptors.

PR-URL: https://github.com/iojs/io.js/pull/875
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Vladimir Kurchatkin <vladimir.kurchatkin@gmail.com>
src/node.cc
test/parallel/test-stdio-closed.js [new file with mode: 0644]