Date: Fri, 7 Oct 2016 19:02:13 +0000 (UTC) From: Mariusz Zaborski <oshogbo@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r306820 - head/usr.bin/cmp Message-ID: <201610071902.u97J2DHJ070592@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: oshogbo Date: Fri Oct 7 19:02:13 2016 New Revision: 306820 URL: https://svnweb.freebsd.org/changeset/base/306820 Log: Restrict stdin if it's not in use. Reviewed by: emaste, cem Differential Revision: https://reviews.freebsd.org/D8184 Modified: head/usr.bin/cmp/cmp.c Modified: head/usr.bin/cmp/cmp.c ============================================================================== --- head/usr.bin/cmp/cmp.c Fri Oct 7 18:56:24 2016 (r306819) +++ head/usr.bin/cmp/cmp.c Fri Oct 7 19:02:13 2016 (r306820) @@ -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");
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201610071902.u97J2DHJ070592>