From: kosmirror <kos...@us...> - 2025-05-21 16:36:52
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 5ac5dbae9c76ad4a239f3e0afb76d782dd5471df (commit) from 49e939a5c0fea9af48357bf250dba14db975fc8a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 5ac5dbae9c76ad4a239f3e0afb76d782dd5471df Author: QuzarDC <qu...@co...> Date: Sun May 18 04:22:28 2025 -0400 `libkosext2fs`: Ensure buffer can store uint32s. As the malloc'd returned buffer is accessed as `uint32_t *` we should ensure that the size of it is a multiple of 4 otherwise we could read into unallocated memory. ----------------------------------------------------------------------- Summary of changes: addons/libkosext2fs/inode.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/libkosext2fs/inode.c b/addons/libkosext2fs/inode.c index a8cb184f..64695b72 100644 --- a/addons/libkosext2fs/inode.c +++ b/addons/libkosext2fs/inode.c @@ -989,9 +989,11 @@ static ext2_dirent_t *search_indir_23(ext2_fs_t *fs, const uint32_t *iblock, uint32_t *buf; int i, block_ents; ext2_dirent_t *rv; + /* Ensure the buffer will hold uint32_ts */ + size_t bufsize = __align_up(block_size, sizeof(buf[0])); /* We're going to need this buffer... */ - if(!(buf = (uint32_t *)malloc(block_size))) { + if(!(buf = (uint32_t *)malloc(bufsize))) { *err = -ENOMEM; return NULL; } hooks/post-receive -- A pseudo Operating System for the Dreamcast. |