summaryrefslogtreecommitdiff
path: root/usr.bin/ipcs/ipcs.c
diff options
context:
space:
mode:
authorPaul Traina <pst@FreeBSD.org>1996-05-30 02:18:44 +0000
committerPaul Traina <pst@FreeBSD.org>1996-05-30 02:18:44 +0000
commit661a5e433a9a2afc2c622f06524018ebd7d7bc04 (patch)
tree1e97cf6b0399d73829f5a8315c6ea65afda4bdfc /usr.bin/ipcs/ipcs.c
parentcd73303c45bb6e18046b71e3675856499c414f07 (diff)
Notes
Diffstat (limited to 'usr.bin/ipcs/ipcs.c')
-rw-r--r--usr.bin/ipcs/ipcs.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/usr.bin/ipcs/ipcs.c b/usr.bin/ipcs/ipcs.c
index cd4e5cc3c3b8..a755b918be42 100644
--- a/usr.bin/ipcs/ipcs.c
+++ b/usr.bin/ipcs/ipcs.c
@@ -24,7 +24,7 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: ipcs.c,v 1.3 1994/09/19 10:24:38 davidg Exp $
+ * $Id: ipcs.c,v 1.4 1995/07/12 19:10:17 bde Exp $
*/
#include <stdio.h>
@@ -185,6 +185,14 @@ 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);