diff options
author | Andreas Kling <kling@serenityos.org> | 2021-02-05 20:03:49 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-02-05 21:23:11 +0100 |
commit | 4c0707e56c207bf5deb9e322efa61cb9de3b862a (patch) | |
tree | b4640de1ae0b65308682429a1ad81ea050f51e3e /Kernel/FileSystem | |
parent | d164f89ada92529f7d03d5bfddbabbbc4ea4777c (diff) | |
download | serenity-4c0707e56c207bf5deb9e322efa61cb9de3b862a.zip |
Kernel: Don't create a zero-length VLA in Ext2FS block list walk
Found by KUBSAN :^)
Diffstat (limited to 'Kernel/FileSystem')
-rw-r--r-- | Kernel/FileSystem/Ext2FileSystem.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Kernel/FileSystem/Ext2FileSystem.cpp b/Kernel/FileSystem/Ext2FileSystem.cpp index 7ed5212404..7ae70fc106 100644 --- a/Kernel/FileSystem/Ext2FileSystem.cpp +++ b/Kernel/FileSystem/Ext2FileSystem.cpp @@ -501,6 +501,8 @@ Vector<Ext2FS::BlockIndex> Ext2FS::block_list_for_inode_impl(const ext2_inode& e if (include_block_list_blocks) add_block(array_block_index); auto count = min(blocks_remaining, entries_per_block); + if (!count) + return; u32 array[count]; auto buffer = UserOrKernelBuffer::for_kernel_buffer((u8*)array); auto result = read_block(array_block_index, &buffer, sizeof(array), 0); |