diff options
Diffstat (limited to 'usr.bin/ipcs')
-rw-r--r-- | usr.bin/ipcs/ipcs.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/usr.bin/ipcs/ipcs.c b/usr.bin/ipcs/ipcs.c index 38855e85e60..081eb086cd4 100644 --- a/usr.bin/ipcs/ipcs.c +++ b/usr.bin/ipcs/ipcs.c @@ -181,6 +181,12 @@ main(argc, argv) default: usage(); } + /* + * Discard setgid privileges if not the running kernel so that bad + * guys can't print interesting stuff from kernel memory. + */ + if (namelist != NULL || core != NULL) + setgid(getgid()); if ((kd = kvm_open(namelist, core, NULL, O_RDONLY, "ipcs")) == NULL) exit(1); |