-/* $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 $ */
/*-
/* 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 */
-/* $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 $ */
/*
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
-/* $OpenBSD: core.h,v 1.7 2016/09/17 06:09:08 guenther Exp $ */
+/* $OpenBSD: core.h,v 1.8 2022/02/22 17:14:13 deraadt Exp $ */
/* $NetBSD: core.h,v 1.4 1994/10/29 08:20:14 cgd Exp $ */
/*
u_int16_t c_hdrsize; /* Size of this header (machdep algn) */
u_int16_t c_seghdrsize; /* Size of a segment header */
u_int32_t c_nseg; /* # of core segments */
- char c_name[MAXCOMLEN+1]; /* Copy of p->p_comm */
+ char c_name[_MAXCOMLEN]; /* Copy of p->p_comm, incl NUL */
u_int32_t c_signo; /* Killing signal */
u_long c_ucode; /* Hmm ? */
u_long c_cpusize; /* Size of machine dependent segment */
-/* $OpenBSD: ktrace.h,v 1.40 2021/03/10 10:21:47 jsg Exp $ */
+/* $OpenBSD: ktrace.h,v 1.41 2022/02/22 17:14:14 deraadt Exp $ */
/* $NetBSD: ktrace.h,v 1.12 1996/02/04 02:12:29 christos Exp $ */
/*
*/
#include <sys/uio.h>
+#include <sys/syslimits.h>
/*
* operations to ktrace system call (KTROP(op))
pid_t ktr_pid; /* process id */
pid_t ktr_tid; /* thread id */
struct timespec ktr_time; /* timestamp */
- char ktr_comm[MAXCOMLEN+1]; /* command name */
+ char ktr_comm[_MAXCOMLEN]; /* command name, incl NUL */
size_t ktr_len; /* length of buf */
};
-/* $OpenBSD: proc.h,v 1.326 2022/02/15 23:16:00 rob Exp $ */
+/* $OpenBSD: proc.h,v 1.327 2022/02/22 17:14:14 deraadt Exp $ */
/* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */
/*-
struct plimit *ps_limit; /* [m,R] Process limits. */
struct pgrp *ps_pgrp; /* Pointer to process group. */
- char ps_comm[MAXCOMLEN+1];
+ char ps_comm[_MAXCOMLEN]; /* command name, incl NUL */
vaddr_t ps_strings; /* User pointers to argv/env */
vaddr_t ps_timekeep; /* User pointer to timekeep */