From 65bc027257fd181a4ab37ce84f7820bc53b01231 Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Mon, 30 Sep 2019 16:10:42 +0000 Subject: [PATCH] Capsicumize c++filt(1). Reviewed by: emaste Discussed with: oshogbo Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21106 --- contrib/elftoolchain/cxxfilt/cxxfilt.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/contrib/elftoolchain/cxxfilt/cxxfilt.c b/contrib/elftoolchain/cxxfilt/cxxfilt.c index 9a051fb4151..21535ff21d5 100644 --- a/contrib/elftoolchain/cxxfilt/cxxfilt.c +++ b/contrib/elftoolchain/cxxfilt/cxxfilt.c @@ -25,6 +25,8 @@ */ #include + +#include #include #include #include @@ -165,6 +167,11 @@ main(int argc, char **argv) argv += optind; argc -= optind; + if (caph_limit_stdio() < 0) + err(EXIT_FAILURE, "failed to limit stdio rights"); + if (caph_enter() < 0) + err(EXIT_FAILURE, "failed to enter capability mode"); + if (*argv != NULL) { for (n = 0; n < argc; n++) { if ((dem = demangle(argv[n])) == NULL)