mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-20 22:48:22 +00:00
* grub-core/fs/hfs.c (grub_hfs_mount): Additional filesystem sanity checks.
This commit is contained in:
1 parent
5ed3a5d049
commit
98f74998d5
2 files changed
+11
No files matched your search
@@ -330,6 +330,7 @@ grub_hfs_mount (grub_disk_t disk)
|
||||
|
||||
/* Check if this is a HFS filesystem. */
|
||||
if (grub_be_to_cpu16 (data->sblock.magic) != GRUB_HFS_MAGIC
|
||||
|| data->sblock.blksz == 0
|
||||
|| (data->sblock.blksz & grub_cpu_to_be32_compile_time (0xc00001ff)))
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FS, "not an HFS filesystem");
|
||||
@@ -367,6 +368,11 @@ grub_hfs_mount (grub_disk_t disk)
|
||||
data->cat_root = grub_be_to_cpu32 (treehead.head.root_node);
|
||||
data->cat_size = grub_be_to_cpu16 (treehead.head.node_size);
|
||||
|
||||
if (data->cat_size == 0
|
||||
|| data->blksz < data->cat_size
|
||||
|| data->blksz < data->ext_size)
|
||||
goto fail;
|
||||
|
||||
/* Lookup the root directory node in the catalog tree using the
|
||||
volume name. */
|
||||
key.parent_dir = grub_cpu_to_be32_compile_time (1);
|
||||
|
||||
Reference in new issue
Block a user