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");
 
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to