diff options
author | Ian Moffett <ian@osmora.org> | 2025-06-03 16:41:21 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-06-03 16:41:21 -0400 |
commit | 42cde478e31ccfe1b6520dd6c54d4405e09bffc7 (patch) | |
tree | 85fcac1fe92d5cee24d5cb067fb0acf794233421 /sys/dev | |
parent | fd4f7c5d2ffa875368437c78a13eb8fc7595d49d (diff) |
kernel: device: Harden cdev mmap() bounds checks
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/video/fbdev.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/sys/dev/video/fbdev.c b/sys/dev/video/fbdev.c index 391400c..b4b465b 100644 --- a/sys/dev/video/fbdev.c +++ b/sys/dev/video/fbdev.c @@ -45,13 +45,12 @@ static volatile struct limine_framebuffer_request framebuffer_req = { }; static paddr_t -fbdev_mmap(dev_t dev, off_t off, int flags) +fbdev_mmap(dev_t dev, size_t size, off_t off, int flags) { size_t max_bounds; max_bounds = FRAMEBUFFER->pitch * FRAMEBUFFER->height; - max_bounds /= 4; - if (off > max_bounds) { + if ((off + size) > max_bounds) { return 0; } |