summaryrefslogtreecommitdiffstats
path: root/bcd
diff options
context:
space:
mode:
authorhubertf <hubertf@NetBSD.org>1999-07-21 03:59:41 +0000
committerhubertf <hubertf@NetBSD.org>1999-07-21 03:59:41 +0000
commit220927d0337af158483f0d006da703b9d5330cef (patch)
tree14ebb2ccf8cd99724b2a38d3720d46196ebfe968 /bcd
parent36f340bd47acb8baf6515e7754448dbb1e48a5a8 (diff)
downloadbsdgames-darwin-220927d0337af158483f0d006da703b9d5330cef.tar.gz
bsdgames-darwin-220927d0337af158483f0d006da703b9d5330cef.tar.zst
bsdgames-darwin-220927d0337af158483f0d006da703b9d5330cef.zip
Drop setgid privs early; via OpenBSD reported in PR 5970 by
Joseph Myers <jsm28@cam.ac.uk>
Diffstat (limited to 'bcd')
-rw-r--r--bcd/bcd.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/bcd/bcd.c b/bcd/bcd.c
index f0d90f04..2625b261 100644
--- a/bcd/bcd.c
+++ b/bcd/bcd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: bcd.c,v 1.7 1997/10/10 09:54:18 lukem Exp $ */
+/* $NetBSD: bcd.c,v 1.8 1999/07/21 03:59:41 hubertf Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\
#if 0
static char sccsid[] = "@(#)bcd.c 8.2 (Berkeley) 3/20/94";
#else
-__RCSID("$NetBSD: bcd.c,v 1.7 1997/10/10 09:54:18 lukem Exp $");
+__RCSID("$NetBSD: bcd.c,v 1.8 1999/07/21 03:59:41 hubertf Exp $");
#endif
#endif /* not lint */
@@ -85,6 +85,7 @@ __RCSID("$NetBSD: bcd.c,v 1.7 1997/10/10 09:54:18 lukem Exp $");
#include <stdio.h>
#include <string.h>
#include <ctype.h>
+#include <unistd.h>
u_short holes[256] = {
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
@@ -136,6 +137,9 @@ main(argc, argv)
{
char cardline[80];
+ /* revoke setgid privileges */
+ setregid(getgid(), getgid());
+
/*
* The original bcd prompts with a "%" when reading from stdin,
* but this seems kind of silly. So this one doesn't.