Sandbox with pledge(2) on OpenBSD

weechat-hashes
C. McEnroe 2021-01-06 21:09:51 -05:00
parent 3b54425ec1
commit 9ea029c580
1 changed files with 5 additions and 0 deletions

5
chat.c
View File

@ -125,6 +125,11 @@ static void signalHandler(int signal) {
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
setlocale(LC_CTYPE, ""); 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; bool insecure = false;
const char *bind = NULL; const char *bind = NULL;
const char *host = NULL; const char *host = NULL;