mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 12:48:22 +00:00
fat/ext2: fix possible bad memory access
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user