]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Add range checking of partition for MBR.
authorxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 28 Feb 2007 06:22:43 +0000 (06:22 +0000)
committerxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 28 Feb 2007 06:22:43 +0000 (06:22 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2409 6f19259b-4bc3-4df7-8a09-765794883524

EdkModulePkg/Universal/Disk/Partition/Dxe/Mbr.c

index 8dd0b4b497d53b5c8e2ebafbe188d584b190ecb4..f1b1de0d64caa8398e2b0d657b9db67870a35031 100644 (file)
@@ -1,6 +1,6 @@
 /*++\r
 \r
-Copyright (c) 2006, Intel Corporation                                                         \r
+Copyright (c) 2006 - 2007, Intel Corporation                                                         \r
 All rights reserved. This program and the accompanying materials                          \r
 are licensed and made available under the terms and conditions of the BSD License         \r
 which accompanies this distribution.  The full text of the license may be found at        \r
@@ -276,8 +276,8 @@ Returns:
       HdDev.PartitionNumber = PartitionNumber ++;\r
       HdDev.PartitionStart  = UNPACK_UINT32 (Mbr->Partition[0].StartingLBA) + ExtMbrStartingLba + ParentHdDev.PartitionStart;\r
       HdDev.PartitionSize   = UNPACK_UINT32 (Mbr->Partition[0].SizeInLBA);\r
-      if (HdDev.PartitionStart + HdDev.PartitionSize - 1 >=\r
-            ParentHdDev.PartitionStart + ParentHdDev.PartitionSize) {\r
+      if ((HdDev.PartitionStart + HdDev.PartitionSize - 1 >= ParentHdDev.PartitionStart + ParentHdDev.PartitionSize) ||\r
+          (HdDev.PartitionStart <= ParentHdDev.PartitionStart)) {\r
         break;\r
       }\r
 \r