From 574d834c63d1b766bafc91fce3df6b3780b61144 Mon Sep 17 00:00:00 2001 From: guenther Date: Mon, 9 Jan 2023 02:12:13 +0000 Subject: [PATCH] setthrname() should return EINVAL, not ENAMETOOLONG, when the input is too long. ok mpi@ --- sys/kern/kern_prot.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c index 54e169debbb..a2b22cd760a 100644 --- a/sys/kern/kern_prot.c +++ b/sys/kern/kern_prot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_prot.c,v 1.81 2023/01/07 05:24:58 guenther Exp $ */ +/* $OpenBSD: kern_prot.c,v 1.82 2023/01/09 02:12:13 guenther Exp $ */ /* $NetBSD: kern_prot.c,v 1.33 1996/02/09 18:59:42 christos Exp $ */ /* @@ -1157,6 +1157,8 @@ sys_setthrname(struct proc *curp, void *v, register_t *retval) error = copyinstr(SCARG(uap, name), buf, sizeof buf, NULL); if (error == 0) strlcpy(p->p_name, buf, sizeof(p->p_name)); + else if (error == ENAMETOOLONG) + error = EINVAL; *retval = error; return 0; } -- 2.20.1