summaryrefslogtreecommitdiff
path: root/misc/screen/patches/patch-screen.c
diff options
context:
space:
mode:
Diffstat (limited to 'misc/screen/patches/patch-screen.c')
-rw-r--r--misc/screen/patches/patch-screen.c21
1 files changed, 1 insertions, 20 deletions
diff --git a/misc/screen/patches/patch-screen.c b/misc/screen/patches/patch-screen.c
index ccb1459fc00..e3aa44a15f7 100644
--- a/misc/screen/patches/patch-screen.c
+++ b/misc/screen/patches/patch-screen.c
@@ -1,7 +1,6 @@
-$NetBSD: patch-screen.c,v 1.3 2017/01/25 01:17:16 maya Exp $
+$NetBSD: patch-screen.c,v 1.4 2017/04/15 22:31:49 kim Exp $
Use standard headers.
-Don't open user-supplied paths as root.
--- screen.c.orig 2017-01-17 19:28:29.000000000 +0000
+++ screen.c
@@ -14,21 +13,3 @@ Don't open user-supplied paths as root.
#include "screen.h"
#ifdef HAVE_BRAILLE
# include "braille.h"
-@@ -674,11 +676,17 @@ int main(int ac, char** av)
- if (strlen(screenlogfile) > PATH_MAX)
- Panic(0, "-L: logfile name too long. (max. %d char)", PATH_MAX);
-
-+ int issetugid = geteuid() == 0;
-+
-+ if (issetugid && seteuid(getuid()) < 0)
-+ Panic(0, "setuid 1");
- FILE *w_check;
- if ((w_check = fopen(screenlogfile, "w")) == NULL)
- Panic(0, "-L: logfile name access problem");
- else
- fclose(w_check);
-+ if (issetugid && seteuid(0) < 0)
-+ Panic(0, "setuid 2");
- }
- nwin_options.Lflag = 1;
- break;