]> git.proxmox.com Git - grub2.git/commitdiff
* grub-core/fs/hfs.c (grub_hfs_mount): Additional filesystem sanity checks.
authorVladimir Serbinenko <phcoder@gmail.com>
Tue, 20 Jan 2015 13:59:40 +0000 (14:59 +0100)
committerVladimir Serbinenko <phcoder@gmail.com>
Wed, 21 Jan 2015 16:42:11 +0000 (17:42 +0100)
ChangeLog
grub-core/fs/hfs.c

index a5d925a8f7df313dfb70fe68379734ae6b2d18cc..473eb1466635730f96279bb4af73dd0657a1bcfc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-01-20  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * grub-core/fs/hfs.c (grub_hfs_mount): Additional filesystem
+       sanity checks.
+
 2015-01-20  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * grub-core/fs/minix.c: Additional filesystem
index d1dc015455d74d8a74cad7800603902734a0053d..f46f77a945d164bf9d0e8e4207c40dc2755aa8f4 100644 (file)
@@ -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);