summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_exec.c5
-rw-r--r--sys/kern/kern_ktrace.c4
2 files changed, 4 insertions, 5 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index ab37a18c8dd..bf0e51ca696 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_exec.c,v 1.229 2022/02/07 19:30:48 guenther Exp $ */
+/* $OpenBSD: kern_exec.c,v 1.230 2022/02/22 17:14:14 deraadt Exp $ */
/* $NetBSD: kern_exec.c,v 1.75 1996/02/09 18:59:28 christos Exp $ */
/*-
@@ -508,8 +508,7 @@ sys_execve(struct proc *p, void *v, register_t *retval)
/* set command name & other accounting info */
memset(pr->ps_comm, 0, sizeof(pr->ps_comm));
- len = min(nid.ni_cnd.cn_namelen, MAXCOMLEN);
- memcpy(pr->ps_comm, nid.ni_cnd.cn_nameptr, len);
+ strlcpy(pr->ps_comm, nid.ni_cnd.cn_nameptr, sizeof(pr->ps_comm));
pr->ps_acflag &= ~AFORK;
/* record proc's vnode, for use by sysctl */
diff --git a/sys/kern/kern_ktrace.c b/sys/kern/kern_ktrace.c
index 23b2af5c88d..e8810fb0264 100644
--- a/sys/kern/kern_ktrace.c
+++ b/sys/kern/kern_ktrace.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_ktrace.c,v 1.105 2021/12/23 18:50:32 guenther Exp $ */
+/* $OpenBSD: kern_ktrace.c,v 1.106 2022/02/22 17:14:14 deraadt Exp $ */
/* $NetBSD: kern_ktrace.c,v 1.23 1996/02/09 18:59:36 christos Exp $ */
/*
@@ -141,7 +141,7 @@ ktrinitheader(struct ktr_header *kth, struct proc *p, int type)
struct process *pr = p->p_p;
ktrinitheaderraw(kth, type, pr->ps_pid, p->p_tid + THREAD_PID_OFFSET);
- memcpy(kth->ktr_comm, pr->ps_comm, MAXCOMLEN);
+ memcpy(kth->ktr_comm, pr->ps_comm, sizeof(kth->ktr_comm));
}
int