From 9ea029c5805f00861db3dfc09b6c9483fe77c5cf Mon Sep 17 00:00:00 2001 From: C. McEnroe Date: Wed, 6 Jan 2021 21:09:51 -0500 Subject: Sandbox with pledge(2) on OpenBSD --- chat.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/chat.c b/chat.c index 296c0c4..016d604 100644 --- a/chat.c +++ b/chat.c @@ -125,6 +125,11 @@ static void signalHandler(int signal) { int main(int argc, char *argv[]) { setlocale(LC_CTYPE, ""); +#ifdef __OpenBSD__ + int error = pledge("stdio rpath wpath cpath inet dns tty proc exec", NULL); + if (error) err(EX_OSERR, "pledge"); +#endif + bool insecure = false; const char *bind = NULL; const char *host = NULL; -- cgit 1.4.1-2-gfad0