Fix BDS boot from file . and .. fail assertion

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1237 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
xgu3 2006-08-10 12:53:55 +00:00
parent 202c5d55e5
commit 4224ac2087
1 changed files with 23 additions and 2 deletions

View File

@ -1055,6 +1055,27 @@ Returns:
return MenuCount; return MenuCount;
} }
CHAR16 *
BdsStrCpy (
OUT CHAR16 *Destination,
IN CONST CHAR16 *Source
)
{
CHAR16 *ReturnValue;
//
// Destination cannot be NULL
//
ASSERT (Destination != NULL);
ReturnValue = Destination;
while (*Source) {
*(Destination++) = *(Source++);
}
*Destination = 0;
return ReturnValue;
}
CHAR16 * CHAR16 *
BOpt_AppendFileName ( BOpt_AppendFileName (
IN CHAR16 *Str1, IN CHAR16 *Str1,
@ -1102,13 +1123,13 @@ Returns:
// DO NOT convert the .. if it is at the end of the string. This will // DO NOT convert the .. if it is at the end of the string. This will
// break the .. behavior in changing directories. // break the .. behavior in changing directories.
// //
StrCpy (LastSlash, Ptr + 3); BdsStrCpy (LastSlash, Ptr + 3);
Ptr = LastSlash; Ptr = LastSlash;
} else if (*Ptr == '\\' && *(Ptr + 1) == '.' && *(Ptr + 2) == '\\') { } else if (*Ptr == '\\' && *(Ptr + 1) == '.' && *(Ptr + 2) == '\\') {
// //
// Convert a \.\ to a \ // Convert a \.\ to a \
// //
StrCpy (Ptr, Ptr + 2); BdsStrCpy (Ptr, Ptr + 2);
Ptr = LastSlash; Ptr = LastSlash;
} else if (*Ptr == '\\') { } else if (*Ptr == '\\') {
LastSlash = Ptr; LastSlash = Ptr;