summaryrefslogtreecommitdiff
path: root/src/kernel/vfs/procfs.c
diff options
context:
space:
mode:
authordzwdz2023-01-24 18:49:58 +0100
committerdzwdz2023-01-24 18:49:58 +0100
commit52e7fe3c679469032e77a5ca4adf19618ba1201b (patch)
tree1359c692e4f2e8ff172fdeb9d6643328f6e89a4c /src/kernel/vfs/procfs.c
parentecf724116488651a0dba3880fb89aca308e2251b (diff)
kernel/procfs: prevent reading kernel memory
knew it
Diffstat (limited to 'src/kernel/vfs/procfs.c')
-rw-r--r--src/kernel/vfs/procfs.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/kernel/vfs/procfs.c b/src/kernel/vfs/procfs.c
index a417606..be907fd 100644
--- a/src/kernel/vfs/procfs.c
+++ b/src/kernel/vfs/procfs.c
@@ -123,6 +123,10 @@ procfs_accept(struct vfs_request *req)
virt_cpy_to(req->caller->pages, req->output.buf, buf, pos);
vfsreq_finish_short(req, pos);
} else if (req->type == VFSOP_READ && h->type == PhMem) {
+ if (p->pages == NULL || req->caller->pages == NULL) {
+ vfsreq_finish_short(req, 0);
+ return;
+ }
size_t res = virt_cpy(
req->caller->pages, req->output.buf,
p->pages, (__user void*)req->offset,