From 331f63bc7e8e80e914bb8fb93ef48381bc737feb Mon Sep 17 00:00:00 2001 From: dzwdz Date: Fri, 1 Jul 2022 21:43:49 +0200 Subject: kernel/fsroot: respect offset when reading root --- src/kernel/arch/i386/driver/fsroot.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/kernel/arch/i386/driver') diff --git a/src/kernel/arch/i386/driver/fsroot.c b/src/kernel/arch/i386/driver/fsroot.c index 4207541..bea89cd 100644 --- a/src/kernel/arch/i386/driver/fsroot.c +++ b/src/kernel/arch/i386/driver/fsroot.c @@ -74,7 +74,9 @@ static int handle(struct vfs_request *req) { "ps2\0" "ata/"; int len = min((size_t) req->output.len, sizeof(src)); - virt_cpy_to(req->caller->pages, req->output.buf, src, len); + if (req->offset > len) return 0; + virt_cpy_to(req->caller->pages, req->output.buf, + src + req->offset, len - req->offset); return len; } case HANDLE_VGA: { -- cgit v1.2.3