diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2007-11-19 17:47:48 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2007-11-19 17:47:48 +0000 |
commit | d1c708cba9eb3148adc463bcb383ab8f64638f8d (patch) | |
tree | c70562105bc845e48c0e7925df7a249469c88e19 | |
parent | b886e6eb26b09014dbe87f17b003be41abbbe05f (diff) |
Don't overwrite a core file owned by a different user. Makes the code
match the comment. OK deraadt@
-rw-r--r-- | sys/kern/kern_sig.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 9338fb56336..bbef689712a 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sig.c,v 1.95 2007/09/01 15:14:44 martin Exp $ */ +/* $OpenBSD: kern_sig.c,v 1.96 2007/11/19 17:47:47 millert Exp $ */ /* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */ /* @@ -1406,9 +1406,9 @@ coredump(struct proc *p) vp = nd.ni_vp; if ((error = VOP_GETATTR(vp, &vattr, cred, p)) != 0) goto out; - /* Don't dump to non-regular files or files with links. */ if (vp->v_type != VREG || vattr.va_nlink != 1 || - vattr.va_mode & ((VREAD | VWRITE) >> 3 | (VREAD | VWRITE) >> 6)) { + vattr.va_mode & ((VREAD | VWRITE) >> 3 | (VREAD | VWRITE) >> 6) || + vattr.va_uid != cred->cr_uid) { error = EACCES; goto out; } |