summaryrefslogtreecommitdiff
path: root/src/kernel/syscalls.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/syscalls.c
parent8929eb838bec8d3f5eb0d5a1c6b91a4f27d0baff (diff)
kernel: fix procfs overflow bug, add safeguard to prevent similar ones
Diffstat (limited to 'src/kernel/syscalls.c')
-rw-r--r--src/kernel/syscalls.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/kernel/syscalls.c b/src/kernel/syscalls.c
index 66f8757..ebdf64e 100644
--- a/src/kernel/syscalls.c
+++ b/src/kernel/syscalls.c
@@ -295,7 +295,7 @@ long _sys_fs_respond(hid_t hid, const void __user *buf, long ret, int flags) {
if (!h || h->type != HANDLE_FS_REQ) SYSCALL_RETURN(-EBADF);
VfsReq *req = h->req;
if (req) {
- if (req->output.len > 0 && ret > 0) {
+ if (ret > 0 && req->type == VFSOP_READ) {
// if this vfsop outputs data and ret is positive, it's the length of the buffer
// TODO document
// TODO move to vfsreq_finish