Restrict stdin if it's not in use.

Reviewed by:	emaste, cem
Differential Revision:	https://reviews.freebsd.org/D8184
This commit is contained in:
Mariusz Zaborski 2016-10-07 19:02:13 +00:00
parent a4e3fc54a0
commit abdfa0b19c

View File

@ -164,6 +164,14 @@ main(int argc, char *argv[])
if (cap_fcntls_limit(fd2, fcntls) < 0 && errno != ENOSYS)
err(ERR_EXIT, "unable to limit fcntls for %s", file2);
if (!special) {
cap_rights_init(&rights);
if (cap_rights_limit(STDIN_FILENO, &rights) < 0 &&
errno != ENOSYS) {
err(ERR_EXIT, "unable to limit stdio");
}
}
if (caph_limit_stdout() == -1 || caph_limit_stderr() == -1)
err(ERR_EXIT, "unable to limit stdio");