diff options
author | truckman <truckman@FreeBSD.org> | 1998-12-13 07:07:51 +0000 |
---|---|---|
committer | truckman <truckman@FreeBSD.org> | 1998-12-13 07:07:51 +0000 |
commit | 40ad5890f99644f19f0ac0348b6a383e4137d709 (patch) | |
tree | 201418f398f476dd49dc9ae8a0a36003fd3242a1 /sys/kern/kern_prot.c | |
parent | 1d1d7ca7770a9a9d5960d2bf59cc64cb88a0cd7d (diff) | |
download | FreeBSD-src-40ad5890f99644f19f0ac0348b6a383e4137d709.zip FreeBSD-src-40ad5890f99644f19f0ac0348b6a383e4137d709.tar.gz |
getpgid() and getsid() were doing a comparision rather than an assignment,
which is fortunate, because otherwise another bug would allow them to be
used to stomp on the syscall return value of another process.
Diffstat (limited to 'sys/kern/kern_prot.c')
-rw-r--r-- | sys/kern/kern_prot.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c index eae9bae..e5e1a3e 100644 --- a/sys/kern/kern_prot.c +++ b/sys/kern/kern_prot.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)kern_prot.c 8.6 (Berkeley) 1/21/94 - * $Id: kern_prot.c,v 1.41 1998/11/09 15:07:42 truckman Exp $ + * $Id: kern_prot.c,v 1.42 1998/11/10 09:16:29 peter Exp $ */ /* @@ -122,13 +122,16 @@ getpgid(p, uap) struct proc *p; struct getpgid_args *uap; { + struct proc *pt; + + pt = p; if (uap->pid == 0) goto found; - if ((p == pfind(uap->pid)) == 0) + if ((pt = pfind(uap->pid)) == 0) return ESRCH; found: - p->p_retval[0] = p->p_pgrp->pg_id; + p->p_retval[0] = pt->p_pgrp->pg_id; return 0; } @@ -146,13 +149,16 @@ getsid(p, uap) struct proc *p; struct getsid_args *uap; { + struct proc *pt; + + pt = p; if (uap->pid == 0) goto found; - if ((p == pfind(uap->pid)) == 0) + if ((pt == pfind(uap->pid)) == 0) return ESRCH; found: - p->p_retval[0] = p->p_session->s_sid; + p->p_retval[0] = pt->p_session->s_sid; return 0; } |