summaryrefslogtreecommitdiff
path: root/src/kernel/vfs/request.c
diff options
context:
space:
mode:
authordzwdz2023-06-17 22:19:36 +0200
committerdzwdz2023-06-17 23:39:27 +0200
commitb528a54a708c4cd2149c8e6884af2063c2b272cd (patch)
treeded8aff45f2d5e7f08eb68f710edc7b9b164d5a2 /src/kernel/vfs/request.c
parent8929eb838bec8d3f5eb0d5a1c6b91a4f27d0baff (diff)
kernel: fix procfs overflow bug, add safeguard to prevent similar ones
Diffstat (limited to 'src/kernel/vfs/request.c')
-rw-r--r--src/kernel/vfs/request.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/kernel/vfs/request.c b/src/kernel/vfs/request.c
index 410e41e..5723201 100644
--- a/src/kernel/vfs/request.c
+++ b/src/kernel/vfs/request.c
@@ -73,6 +73,10 @@ void vfsreq_finish(VfsReq *req, char __user *stored, long ret,
}
}
+ if (req->type == VFSOP_READ && ret >= 0) {
+ assert((size_t)ret <= req->output.len);
+ }
+
if (req->input.kern)
kfree(req->input.buf_kern);