summaryrefslogtreecommitdiffstats
path: root/Tools/CCode
diff options
context:
space:
mode:
authorxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>2007-01-10 07:58:08 +0000
committerxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>2007-01-10 07:58:08 +0000
commitcee3584d1ef1cc37724b198b3044d52e0e094c66 (patch)
treea49c0869e08d877559e191fdd62381504b61e509 /Tools/CCode
parenta9a812a0ed4ab3d83941fdc6da281aebdb9bb296 (diff)
downloadedk2-cee3584d1ef1cc37724b198b3044d52e0e094c66.tar.gz
edk2-cee3584d1ef1cc37724b198b3044d52e0e094c66.tar.bz2
edk2-cee3584d1ef1cc37724b198b3044d52e0e094c66.zip
Original range calculation in GetNextFile() is incorrect.
This patch fixes this issue. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2207 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Tools/CCode')
-rw-r--r--Tools/CCode/Source/Common/FvLib.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/Tools/CCode/Source/Common/FvLib.c b/Tools/CCode/Source/Common/FvLib.c
index e8d62791f3..f526a30e1a 100644
--- a/Tools/CCode/Source/Common/FvLib.c
+++ b/Tools/CCode/Source/Common/FvLib.c
@@ -1,6 +1,6 @@
/*++
-Copyright (c) 2004, Intel Corporation
+Copyright (c) 2004 - 2006, 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
@@ -180,7 +180,7 @@ Returns:
//
// Verify file is in this FV.
//
- if ((UINTN) CurrentFile >= (UINTN) mFvHeader + mFvLength - sizeof (EFI_FFS_FILE_HEADER)) {
+ if ((UINTN) CurrentFile + GetLength (CurrentFile->Size) > (UINTN) mFvHeader + mFvLength) {
*NextFile = NULL;
return EFI_SUCCESS;
}
@@ -192,9 +192,9 @@ Returns:
//
// Verify current file is in range
//
- if (((UINTN) CurrentFile < (UINTN) mFvHeader + sizeof (EFI_FIRMWARE_VOLUME_HEADER)) ||
- ((UINTN) CurrentFile >= (UINTN) mFvHeader + mFvLength - sizeof (EFI_FIRMWARE_VOLUME_HEADER))
- ) {
+ if (((UINTN) CurrentFile < (UINTN) mFvHeader + mFvHeader->HeaderLength) ||
+ ((UINTN) CurrentFile + GetLength (CurrentFile->Size) > (UINTN) mFvHeader + mFvLength)
+ ) {
return EFI_INVALID_PARAMETER;
}
//
@@ -205,7 +205,9 @@ Returns:
//
// Verify file is in this FV.
//
- if ((UINTN) *NextFile >= (UINTN) mFvHeader + mFvLength - sizeof (EFI_FFS_FILE_HEADER)) {
+ if (((UINTN) *NextFile + sizeof (EFI_FFS_FILE_HEADER) >= (UINTN) mFvHeader + mFvLength) ||
+ ((UINTN) *NextFile + GetLength ((*NextFile)->Size) > (UINTN) mFvHeader + mFvLength)
+ ) {
*NextFile = NULL;
return EFI_SUCCESS;
}