summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Mestre <mestre@cvs.openbsd.org>2018-08-23 06:26:36 +0000
committerRicardo Mestre <mestre@cvs.openbsd.org>2018-08-23 06:26:36 +0000
commit5cf28d5e0e5471dd465cb8225080a81820086a28 (patch)
tree9ad615a3640be2ca7b6017bfdd5ffcabed8d0109
parent8f49e0f48d826a681dd488ac5c158c8380275114 (diff)
reduce pledge(2) to "stdio tty" after ncurses initialization. robots(6) uses a
scorefile nevertheless an fd is opened way in advance and therefore we can disable any further access to the filesystem. OK tb@
-rw-r--r--games/robots/main.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/games/robots/main.c b/games/robots/main.c
index 8095529ad6e..e7918dfa63d 100644
--- a/games/robots/main.c
+++ b/games/robots/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.26 2017/05/28 21:01:13 tedu Exp $ */
+/* $OpenBSD: main.c,v 1.27 2018/08/23 06:26:35 mestre Exp $ */
/* $NetBSD: main.c,v 1.5 1995/04/22 10:08:54 cgd Exp $ */
/*
@@ -140,6 +140,10 @@ main(int ac, char *av[])
}
initscr();
+
+ if (pledge("stdio tty", NULL) == -1)
+ err(1, "pledge");
+
signal(SIGINT, quit);
cbreak();
noecho();