aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_filedesc.c
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-04-06 21:29:33 -0400
committerIan Moffett <ian@osmora.org>2024-04-06 21:29:33 -0400
commit75de19a1b792f5a3f7b04c5ce8a8c00de3770e8b (patch)
treefa603cca8df3df7fc40a94b1f8b0c6ae7ac7c474 /sys/kern/kern_filedesc.c
parentc3d6d95c0e1ab9a18a401be29947b2dd111b35b4 (diff)
kernel: Check copyin() status
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/kern/kern_filedesc.c')
-rw-r--r--sys/kern/kern_filedesc.c4
1 files changed, 3 insertions, 1 deletions
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);