From: xli24 Date: Wed, 28 Feb 2007 06:22:43 +0000 (+0000) Subject: Add range checking of partition for MBR. X-Git-Tag: edk2-stable201903~23468 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=2c33bcb4f2bfe2e85d4f6b246b26c96cf971c318 Add range checking of partition for MBR. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2409 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/EdkModulePkg/Universal/Disk/Partition/Dxe/Mbr.c b/EdkModulePkg/Universal/Disk/Partition/Dxe/Mbr.c index 8dd0b4b497..f1b1de0d64 100644 --- a/EdkModulePkg/Universal/Disk/Partition/Dxe/Mbr.c +++ b/EdkModulePkg/Universal/Disk/Partition/Dxe/Mbr.c @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2006, Intel Corporation +Copyright (c) 2006 - 2007, Intel Corporation All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -276,8 +276,8 @@ Returns: HdDev.PartitionNumber = PartitionNumber ++; HdDev.PartitionStart = UNPACK_UINT32 (Mbr->Partition[0].StartingLBA) + ExtMbrStartingLba + ParentHdDev.PartitionStart; HdDev.PartitionSize = UNPACK_UINT32 (Mbr->Partition[0].SizeInLBA); - if (HdDev.PartitionStart + HdDev.PartitionSize - 1 >= - ParentHdDev.PartitionStart + ParentHdDev.PartitionSize) { + if ((HdDev.PartitionStart + HdDev.PartitionSize - 1 >= ParentHdDev.PartitionStart + ParentHdDev.PartitionSize) || + (HdDev.PartitionStart <= ParentHdDev.PartitionStart)) { break; }