From b94f27eea394cdda668fa506c05f9cdd1ce4cf3b Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Mon, 26 Mar 2012 04:19:56 +0000 Subject: clear junk in p_comm before copying shorter names into it ok jsing guenther miod --- sys/kern/kern_exec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sys/kern/kern_exec.c') 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 */ -- cgit v1.2.3