summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ncrcontrol
diff options
context:
space:
mode:
authorpst <pst@FreeBSD.org>1996-05-30 02:19:43 +0000
committerpst <pst@FreeBSD.org>1996-05-30 02:19:43 +0000
commit20544fa323e08da49e207624c4e1a7626ce6acbc (patch)
treec9b57ef3bd6ec7f6e716be5a09917e151883d423 /usr.sbin/ncrcontrol
parent94a7f8648c30a71e955d8fdc8b637b0701a59e33 (diff)
downloadFreeBSD-src-20544fa323e08da49e207624c4e1a7626ce6acbc.zip
FreeBSD-src-20544fa323e08da49e207624c4e1a7626ce6acbc.tar.gz
Drop privileges if not using standard namelist or file.
Submitted by: smpatel (Sujal Patel)
Diffstat (limited to 'usr.sbin/ncrcontrol')
-rw-r--r--usr.sbin/ncrcontrol/ncrcontrol.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/usr.sbin/ncrcontrol/ncrcontrol.c b/usr.sbin/ncrcontrol/ncrcontrol.c
index f7c687d..da3f43c 100644
--- a/usr.sbin/ncrcontrol/ncrcontrol.c
+++ b/usr.sbin/ncrcontrol/ncrcontrol.c
@@ -1,6 +1,6 @@
/**************************************************************************
**
-** $Id: ncrcontrol.c,v 1.9 1995/09/14 18:14:28 se Exp $
+** $Id: ncrcontrol.c,v 1.10 1995/12/28 14:40:59 se Exp $
**
** Utility for NCR 53C810 device driver.
**
@@ -191,6 +191,13 @@ void open_kvm(int flags)
}
#endif
#if defined(__NetBSD__) || (__FreeBSD__ >= 2)
+ /*
+ * Discard setgid privileges if not the running kernel so that bad
+ * guys can't print interesting stuff from kernel memory.
+ */
+ if (vmunix != NULL || kmemf != NULL)
+ setgid(getgid());
+
kvm = kvm_openfiles(vmunix, kmemf, NULL, flags, errbuf);
if (kvm == NULL) {
fprintf(stderr, "%s: kvm_openfiles: %s\n", prog, errbuf);
OpenPOWER on IntegriCloud