fat/ext2: fix possible bad memory access

This commit is contained in:
Matheus
2026-08-21 12:51:21 -03:00
parent ced642b70c
commit ad104e1aa7
2 changed files with 2 additions and 3 deletions
+1 -1
View File
@@ -1813,7 +1813,7 @@ static int ext2_getpage(vnode_t *node, uintmax_t offset, struct page_t *page) {
int error = VOP_READ(node, &iovec_iterator, PAGE_SIZE, offset, 0, &readc, NULL); int error = VOP_READ(node, &iovec_iterator, PAGE_SIZE, offset, 0, &readc, NULL);
if (readc == 0) if (readc == 0)
return ENXIO; return ENXIO;
else if (readc != PAGE_SIZE) else if (readc < PAGE_SIZE)
memset((void *)((uintptr_t)addr + readc), 0, PAGE_SIZE - readc); memset((void *)((uintptr_t)addr + readc), 0, PAGE_SIZE - readc);
return error; return error;
+1 -2
View File
@@ -414,8 +414,7 @@ static int fatfs_getpage(vnode_t *node, uintmax_t offset, struct page_t *page) {
int error = VOP_READ(node, &iovec_iterator, PAGE_SIZE, offset, 0, &read_count, NULL); int error = VOP_READ(node, &iovec_iterator, PAGE_SIZE, offset, 0, &read_count, NULL);
if (read_count == 0) if (read_count == 0)
return ENXIO; return ENXIO;
else if (read_count < PAGE_SIZE)
else if (read_count != PAGE_SIZE)
memset((void *)((uintptr_t)addr + read_count), 0, PAGE_SIZE - read_count); memset((void *)((uintptr_t)addr + read_count), 0, PAGE_SIZE - read_count);
return error; return error;