diff options
author | lgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-02-29 04:56:53 +0000 |
---|---|---|
committer | lgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-02-29 04:56:53 +0000 |
commit | 77a750a550e60b69bf1b43c7413ab15a0cad09d9 (patch) | |
tree | 0044dde46bb7072281917b890ad7abed3201a477 /MdeModulePkg/Core | |
parent | 2b826e217e1ab0bbd1b6b354c81f8fc060523b29 (diff) | |
download | edk2-platforms-77a750a550e60b69bf1b43c7413ab15a0cad09d9.tar.xz |
Fix the issue in PeiCore to support PDB file path without '\' or '.' character.
Signed-off-by: lgao4
Reviewed-by: rsun3
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13069 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Core')
-rw-r--r-- | MdeModulePkg/Core/Pei/Image/Image.c | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/MdeModulePkg/Core/Pei/Image/Image.c b/MdeModulePkg/Core/Pei/Image/Image.c index 843e020142..41069e7a31 100644 --- a/MdeModulePkg/Core/Pei/Image/Image.c +++ b/MdeModulePkg/Core/Pei/Image/Image.c @@ -549,9 +549,9 @@ PeiLoadImageLoadImage ( DEBUG_CODE_BEGIN ();
CHAR8 *AsciiString;
- CHAR8 AsciiBuffer[512];
+ CHAR8 EfiFileName[512];
INT32 Index;
- INT32 Index1;
+ INT32 StartIndex;
//
// Print debug message: Loading PEIM at 0x12345678 EntryPoint=0x12345688 Driver.efi
@@ -571,19 +571,37 @@ PeiLoadImageLoadImage ( AsciiString = PeCoffLoaderGetPdbPointer (Pe32Data);
if (AsciiString != NULL) {
- for (Index = (INT32) AsciiStrLen (AsciiString) - 1; Index >= 0; Index --) {
+ StartIndex = 0;
+ for (Index = 0; AsciiString[Index] != 0; Index++) {
if (AsciiString[Index] == '\\' || AsciiString[Index] == '/') {
- break;
+ StartIndex = Index + 1;
}
}
- if (Index != 0) {
- for (Index1 = 0; AsciiString[Index + 1 + Index1] != '.'; Index1 ++) {
- AsciiBuffer [Index1] = AsciiString[Index + 1 + Index1];
+ //
+ // Copy the PDB file name to our temporary string, and replace .pdb with .efi
+ // The PDB file name is limited in the range of 0~511.
+ // If the length is bigger than 511, trim the redudant characters to avoid overflow in array boundary.
+ //
+ for (Index = 0; Index < sizeof (EfiFileName) - 4; Index++) {
+ EfiFileName[Index] = AsciiString[Index + StartIndex];
+ if (EfiFileName[Index] == 0) {
+ EfiFileName[Index] = '.';
+ }
+ if (EfiFileName[Index] == '.') {
+ EfiFileName[Index + 1] = 'e';
+ EfiFileName[Index + 2] = 'f';
+ EfiFileName[Index + 3] = 'i';
+ EfiFileName[Index + 4] = 0;
+ break;
}
- AsciiBuffer [Index1] = '\0';
- DEBUG ((EFI_D_INFO | EFI_D_LOAD, "%a.efi", AsciiBuffer));
}
+
+ if (Index == sizeof (EfiFileName) - 4) {
+ EfiFileName[Index] = 0;
+ }
+
+ DEBUG ((EFI_D_INFO | EFI_D_LOAD, "%a", EfiFileName));
}
DEBUG_CODE_END ();
|