fix initialization of pointer.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11498 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jcarsey
2011-04-01 16:11:59 +00:00
parent cf4c5a4270
commit 5f2915f593

View File

@ -528,7 +528,7 @@ UpdateStdInStdOutStdErr(
ErrAppend = FALSE; ErrAppend = FALSE;
OutAppend = FALSE; OutAppend = FALSE;
CommandLineCopy = NULL; CommandLineCopy = NULL;
FirstLocation = (CHAR16*)(-1); FirstLocation = NULL;
if (ShellParameters == NULL || SystemTableInfo == NULL || OldStdIn == NULL || OldStdOut == NULL || OldStdErr == NULL) { if (ShellParameters == NULL || SystemTableInfo == NULL || OldStdIn == NULL || OldStdOut == NULL || OldStdErr == NULL) {
return (EFI_INVALID_PARAMETER); return (EFI_INVALID_PARAMETER);
@ -551,6 +551,7 @@ UpdateStdInStdOutStdErr(
CommandLineCopy = StrnCatGrow(&CommandLineCopy, NULL, NewCommandLine, 0); CommandLineCopy = StrnCatGrow(&CommandLineCopy, NULL, NewCommandLine, 0);
Status = EFI_SUCCESS; Status = EFI_SUCCESS;
Split = NULL; Split = NULL;
FirstLocation = CommandLineCopy + StrLen(CommandLineCopy);
StripQuotes(CommandLineCopy); StripQuotes(CommandLineCopy);
@ -810,7 +811,7 @@ UpdateStdInStdOutStdErr(
} }
} }
if (FirstLocation != (CHAR16*)(-1) if (FirstLocation != CommandLineCopy + StrLen(CommandLineCopy)
&& ((UINTN)(FirstLocation - CommandLineCopy) < StrLen(NewCommandLine)) && ((UINTN)(FirstLocation - CommandLineCopy) < StrLen(NewCommandLine))
){ ){
*(NewCommandLine + (UINTN)(FirstLocation - CommandLineCopy)) = CHAR_NULL; *(NewCommandLine + (UINTN)(FirstLocation - CommandLineCopy)) = CHAR_NULL;