[2460] 2009-07-31 Vladimir Serbinenko <[email protected]>

Vladimir Serbinenko <[email protected]> Fri, 31 Jul 2009 16:04:27 +0000
Newsgroups gmane.comp.boot-loaders.grub.cvs
Message-ID <[email protected]>
Revision: 2460
          http://svn.sv.gnu.org/viewvc/?view=rev&root=grub&revision=2460
Author:   phcoder
Date:     2009-07-31 16:04:27 +0000 (Fri, 31 Jul 2009)
Log Message:
-----------
2009-07-31  Vladimir Serbinenko  <[email protected]>

	* partmap/pc.c (pc_partition_map_iterate): Check that boot flags are
	valid.

Modified Paths:
--------------
    trunk/grub2/ChangeLog
    trunk/grub2/partmap/pc.c

Modified: trunk/grub2/ChangeLog
===================================================================
--- trunk/grub2/ChangeLog	2009-07-31 16:01:49 UTC (rev 2459)
+++ trunk/grub2/ChangeLog	2009-07-31 16:04:27 UTC (rev 2460)
@@ -1,3 +1,8 @@
+2009-07-31  Vladimir Serbinenko  <[email protected]>
+
+	* partmap/pc.c (pc_partition_map_iterate): Check that boot flags are
+	valid.
+
 2009-07-31  Bean  <[email protected]>
 
 	* fs/xfs.c (grub_xfs_sblock): Change unused5 field to log2_sect and

Modified: trunk/grub2/partmap/pc.c
===================================================================
--- trunk/grub2/partmap/pc.c	2009-07-31 16:01:49 UTC (rev 2459)
+++ trunk/grub2/partmap/pc.c	2009-07-31 16:04:27 UTC (rev 2460)
@@ -121,6 +121,10 @@
       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++)
 	{