summaryrefslogtreecommitdiff
path: root/sys/kern/kern_exec.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2012-03-26 04:19:56 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2012-03-26 04:19:56 +0000
commitb94f27eea394cdda668fa506c05f9cdd1ce4cf3b (patch)
treea27a517b7dd94b495c70b3909be81e4227cf5325 /sys/kern/kern_exec.c
parent1e72d929a99ccfde7b33d71649fe537b92b700d9 (diff)
clear junk in p_comm before copying shorter names into it
ok jsing guenther miod
Diffstat (limited to 'sys/kern/kern_exec.c')
-rw-r--r--sys/kern/kern_exec.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index 2cf05248187..1940f070803 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_exec.c,v 1.126 2012/03/23 15:51:26 guenther Exp $ */
+/* $OpenBSD: kern_exec.c,v 1.127 2012/03/26 04:19:55 deraadt Exp $ */
/* $NetBSD: kern_exec.c,v 1.75 1996/02/09 18:59:28 christos Exp $ */
/*-
@@ -472,9 +472,9 @@ sys_execve(struct proc *p, void *v, register_t *retval)
TCB_SET(p, NULL); /* reset the TCB address */
/* set command name & other accounting info */
+ bzero(p->p_comm, sizeof(p->p_comm));
len = min(nid.ni_cnd.cn_namelen, MAXCOMLEN);
bcopy(nid.ni_cnd.cn_nameptr, p->p_comm, len);
- p->p_comm[len] = 0;
p->p_acflag &= ~AFORK;
/* record proc's vnode, for use by procfs and others */