From 2c33bcb4f2bfe2e85d4f6b246b26c96cf971c318 Mon Sep 17 00:00:00 2001 From: xli24 Date: Wed, 28 Feb 2007 06:22:43 +0000 Subject: 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 --- EdkModulePkg/Universal/Disk/Partition/Dxe/Mbr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'EdkModulePkg/Universal') 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; } -- cgit v1.2.3