From 75de19a1b792f5a3f7b04c5ce8a8c00de3770e8b Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Sat, 6 Apr 2024 21:29:33 -0400 Subject: kernel: Check copyin() status Signed-off-by: Ian Moffett --- sys/kern/kern_filedesc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'sys') diff --git a/sys/kern/kern_filedesc.c b/sys/kern/kern_filedesc.c index 6cdc1ee..e4fe2f6 100644 --- a/sys/kern/kern_filedesc.c +++ b/sys/kern/kern_filedesc.c @@ -78,7 +78,9 @@ make_write_buf(struct proc *td, const void *data, char **buf_out, size_t count) * A user process called us, so we want to be careful * and use copyin() */ - copyin((uintptr_t)data, buf, count); + if (copyin((uintptr_t)data, buf, count) != 0) { + invalid_uaddr(data); + } } else { /* Can just memcpy() here */ memcpy(buf, (char *)data, count); -- cgit v1.2.3