svn commit: r340385 - head/contrib/elftoolchain/strings
Ed Maste
emaste at FreeBSD.org
Mon Nov 12 20:38:45 UTC 2018
Author: emaste
Date: Mon Nov 12 20:38:43 2018
New Revision: 340385
URL: https://svnweb.freebsd.org/changeset/base/340385
Log:
strings: enter capability mode when operating on stdin
Reviewed by: oshogbo
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Modified:
head/contrib/elftoolchain/strings/strings.c
Modified: head/contrib/elftoolchain/strings/strings.c
==============================================================================
--- head/contrib/elftoolchain/strings/strings.c Mon Nov 12 19:17:26 2018 (r340384)
+++ head/contrib/elftoolchain/strings/strings.c Mon Nov 12 20:38:43 2018 (r340385)
@@ -27,6 +27,7 @@
#include <sys/stat.h>
#include <sys/types.h>
+#include <capsicum_helpers.h>
#include <ctype.h>
#include <err.h>
#include <errno.h>
@@ -188,9 +189,12 @@ main(int argc, char **argv)
if (!min_len)
min_len = 4;
- if (!*argv)
- rc = find_strings("{standard input}", 0, 0);
- else while (*argv) {
+ if (!*argv) {
+ if (caph_limit_stdio() < 0 || caph_enter() < 0)
+ err(1, "unable to enter capability mode");
+ return (find_strings("{standard input}", 0, 0));
+ }
+ while (*argv) {
if (handle_file(*argv) != 0)
rc = 1;
argv++;
More information about the svn-src-all
mailing list