summaryrefslogtreecommitdiff
path: root/usr.sbin/slstat
diff options
context:
space:
mode:
authorPaul Traina <pst@FreeBSD.org>1996-05-30 02:20:10 +0000
committerPaul Traina <pst@FreeBSD.org>1996-05-30 02:20:10 +0000
commit66e5b18f29ab0ed2884941cbae48dddc64e79836 (patch)
tree215b821d997715296d28d3fd6abd875bfae577d1 /usr.sbin/slstat
parent5110a08c3cd137bf4a08ec0deb7373310116a315 (diff)
downloadsrc-test2-66e5b18f29ab0ed2884941cbae48dddc64e79836.tar.gz
src-test2-66e5b18f29ab0ed2884941cbae48dddc64e79836.zip
Notes
Diffstat (limited to 'usr.sbin/slstat')
-rw-r--r--usr.sbin/slstat/slstat.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/usr.sbin/slstat/slstat.c b/usr.sbin/slstat/slstat.c
index 402c24840d17..eb7d3b7a99f8 100644
--- a/usr.sbin/slstat/slstat.c
+++ b/usr.sbin/slstat/slstat.c
@@ -22,7 +22,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: slstat.c,v 1.3 1994/11/19 13:57:21 jkh Exp $";
+static char rcsid[] = "$Id: slstat.c,v 1.4 1995/05/30 03:52:30 rgrimes Exp $";
#endif
#include <stdio.h>
@@ -132,6 +132,13 @@ main(argc, argv)
kflag++;
}
}
+ /*
+ * Discard setgid privileges if not the running kernel so that bad
+ * guys can't print interesting stuff from kernel memory.
+ */
+ if (system != NULL || kmemf != NULL)
+ setgid(getgid());
+
kvm_h = kvm_openfiles(system, kmemf, NULL, O_RDONLY, errbuf);
if (kvm_h == 0) {
(void)fprintf(stderr,