On Tue, Jul 28, 2009 at 7:33 PM, Robert Millan<r...@aybabtu.com> wrote:
> On Sun, Jul 26, 2009 at 03:54:41PM +0200, Vladimir 'phcoder' Serbinenko wrote:
>> +      for (i = 0; i < 4; i++)
>> +     if (mbr.entries[i].flag & 0x7f)
>> +       break;
>> +
>> +      if (i != 4)
>> +     return grub_error (GRUB_ERR_BAD_PART_TABLE, "bad boot flag");
>
> Why not just return directly?
>
Force of canned code written by DMA from memory to keyboard bypassing brain ;)
> --
> Robert Millan
>
>  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
>  how) you may access your data; but nobody's threatening your freedom: we
>  still allow you to remove your data and not access it at all."
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>



-- 
Regards
Vladimir 'phcoder' Serbinenko

Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
diff --git a/ChangeLog b/ChangeLog
index 23c288e..74b9247 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2009-07-28  Vladimir Serbinenko  <phco...@gmail.com>
 
+       * partmap/pc.c (pc_partition_map_iterate): Check that boot flags are
+       valid.
+
+2009-07-28  Vladimir Serbinenko  <phco...@gmail.com>
+
        * loader/i386/multiboot_helper.S (grub_multiboot_backward_relocator):
        Clear direction flag before jumping to OS.
        (grub_multiboot2_real_boot): Likewise.
diff --git a/partmap/pc.c b/partmap/pc.c
index 6f68ecf..6a2efd2 100644
--- a/partmap/pc.c
+++ b/partmap/pc.c
@@ -121,6 +121,10 @@ pc_partition_map_iterate (grub_disk_t disk,
       if (mbr.signature != grub_cpu_to_le16 (GRUB_PC_PARTITION_SIGNATURE))
        return grub_error (GRUB_ERR_BAD_PART_TABLE, "no signature");
 
+      for (i = 0; i < 4; i++)
+       if (mbr.entries[i].flag & 0x7f)
+         return grub_error (GRUB_ERR_BAD_PART_TABLE, "bad boot flag");
+
       /* Analyze DOS partitions.  */
       for (p.index = 0; p.index < 4; p.index++)
        {
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to