From 3bd6905ea81bdab6cbd55fa3c93f333ff5cde937 Mon Sep 17 00:00:00 2001 From: brapru Date: Fri, 30 Jul 2021 23:19:48 -0400 Subject: [PATCH] Utilities: Add pledge and unveil protections in arp --- Userland/Utilities/arp.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Userland/Utilities/arp.cpp b/Userland/Utilities/arp.cpp index 98c7962831..df12be073e 100644 --- a/Userland/Utilities/arp.cpp +++ b/Userland/Utilities/arp.cpp @@ -16,9 +16,25 @@ #include #include #include +#include int main(int argc, char** argv) { + if (pledge("stdio rpath tty", nullptr) < 0) { + perror("pledge"); + return 1; + } + + if (unveil("/proc/net/arp", "r") < 0) { + perror("unveil"); + return 1; + } + + if (unveil(nullptr, nullptr) < 0) { + perror("unveil"); + return 1; + } + static bool flag_set; static bool flag_delete; const char* value_ipv4_address = nullptr;