ShellParametersProtocol - remove parsing from within quoted parameters.

Pci - Add missing enumeration in switch statement.
For - Verify parameter before dereferencing.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11511 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jcarsey 2011-04-07 17:12:12 +00:00
parent b97a8d3586
commit d8f8021cbe
3 changed files with 27 additions and 24 deletions

View File

@ -69,9 +69,7 @@ GetNextParameter(
if ((*Walker)[0] == L'\"') { if ((*Walker)[0] == L'\"') {
NextDelim = NULL; NextDelim = NULL;
for (TempLoc = *Walker + 1 ; TempLoc != NULL && *TempLoc != CHAR_NULL ; TempLoc++) { for (TempLoc = *Walker + 1 ; TempLoc != NULL && *TempLoc != CHAR_NULL ; TempLoc++) {
if (*TempLoc == L'^' && *(TempLoc+1) == L'^') { if (*TempLoc == L'^' && *(TempLoc+1) == L'\"') {
TempLoc++;
} else if (*TempLoc == L'^' && *(TempLoc+1) == L'\"') {
TempLoc++; TempLoc++;
} else if (*TempLoc == L'\"') { } else if (*TempLoc == L'\"') {
NextDelim = TempLoc; NextDelim = TempLoc;
@ -96,10 +94,7 @@ GetNextParameter(
*Walker = NULL; *Walker = NULL;
} }
for (TempLoc = *TempParameter ; TempLoc != NULL && *TempLoc != CHAR_NULL ; TempLoc++) { for (TempLoc = *TempParameter ; TempLoc != NULL && *TempLoc != CHAR_NULL ; TempLoc++) {
if ((*TempLoc == L'^' && *(TempLoc+1) == L'^') if (*TempLoc == L'^' && *(TempLoc+1) == L'\"') {
|| (*TempLoc == L'^' && *(TempLoc+1) == L'|')
|| (*TempLoc == L'^' && *(TempLoc+1) == L'\"')
){
CopyMem(TempLoc, TempLoc+1, StrSize(TempLoc) - sizeof(TempLoc[0])); CopyMem(TempLoc, TempLoc+1, StrSize(TempLoc) - sizeof(TempLoc[0]));
} }
} }
@ -123,9 +118,7 @@ GetNextParameter(
for (NextDelim = *TempParameter ; NextDelim != NULL && *NextDelim != CHAR_NULL ; NextDelim++) { for (NextDelim = *TempParameter ; NextDelim != NULL && *NextDelim != CHAR_NULL ; NextDelim++) {
if (*NextDelim == L'^' && *(NextDelim+1) == L'^') { if (*NextDelim == L'^' && *(NextDelim+1) == L'^') {
CopyMem(NextDelim, NextDelim+1, StrSize(NextDelim) - sizeof(NextDelim[0])); CopyMem(NextDelim, NextDelim+1, StrSize(NextDelim) - sizeof(NextDelim[0]));
}/* else if (*NextDelim == L'^') { }
*NextDelim = L' ';
}*/
} }
while ((*TempParameter)[StrLen(*TempParameter)-1] == L' ') { while ((*TempParameter)[StrLen(*TempParameter)-1] == L' ') {
(*TempParameter)[StrLen(*TempParameter)-1] = CHAR_NULL; (*TempParameter)[StrLen(*TempParameter)-1] = CHAR_NULL;

View File

@ -2781,6 +2781,9 @@ PciExplainData (
); );
CapPtr = ConfigSpace->NonCommon.CardBus.CapabilitiesPtr; CapPtr = ConfigSpace->NonCommon.CardBus.CapabilitiesPtr;
break; break;
case PciUndefined:
default:
break;
} }
// //
// If Status bit4 is 1, dump or explain capability structure // If Status bit4 is 1, dump or explain capability structure
@ -3405,7 +3408,7 @@ PciExplainCardBusData (
INDEX_OF (&(CardBus->IoBase0)), INDEX_OF (&(CardBus->IoBase0)),
Io32Bit ? L" 32 bit" : L" 16 bit", Io32Bit ? L" 32 bit" : L" 16 bit",
CardBus->IoBase0 & (Io32Bit ? 0xfffffffc : 0x0000fffc), CardBus->IoBase0 & (Io32Bit ? 0xfffffffc : 0x0000fffc),
CardBus->IoLimit0 & (Io32Bit ? 0xffffffff : 0x0000ffff) | 0x00000003 (CardBus->IoLimit0 & (Io32Bit ? 0xffffffff : 0x0000ffff)) | 0x00000003
); );
Io32Bit = (BOOLEAN) (CardBus->IoBase1 & PCI_BIT_0); Io32Bit = (BOOLEAN) (CardBus->IoBase1 & PCI_BIT_0);
@ -3415,7 +3418,7 @@ PciExplainCardBusData (
INDEX_OF (&(CardBus->IoBase1)), INDEX_OF (&(CardBus->IoBase1)),
Io32Bit ? L" 32 bit" : L" 16 bit", Io32Bit ? L" 32 bit" : L" 16 bit",
CardBus->IoBase1 & (Io32Bit ? 0xfffffffc : 0x0000fffc), CardBus->IoBase1 & (Io32Bit ? 0xfffffffc : 0x0000fffc),
CardBus->IoLimit1 & (Io32Bit ? 0xffffffff : 0x0000ffff) | 0x00000003 (CardBus->IoLimit1 & (Io32Bit ? 0xffffffff : 0x0000ffff)) | 0x00000003
); );
// //
@ -4690,14 +4693,16 @@ PciExplainPciExpress (
// //
Print (L"\n%HStart dumping PCIex extended configuration space (0x100 - 0xFFF).%N\n\n"); Print (L"\n%HStart dumping PCIex extended configuration space (0x100 - 0xFFF).%N\n\n");
DumpHex ( if (ExRegBuffer != NULL) {
2, DumpHex (
0x100, 2,
ExtendRegSize, 0x100,
(VOID *) (ExRegBuffer) ExtendRegSize,
); (VOID *) (ExRegBuffer)
);
FreePool ((VOID *) ExRegBuffer); FreePool ((VOID *) ExRegBuffer);
}
Done: Done:
return EFI_SUCCESS; return EFI_SUCCESS;

View File

@ -589,11 +589,16 @@ ShellCommandRunFor (
ASSERT(ArgSet == NULL); ASSERT(ArgSet == NULL);
} }
Info = (SHELL_FOR_INFO*)CurrentScriptFile->CurrentCommand->Data; if (CurrentScriptFile != NULL && CurrentScriptFile->CurrentCommand != NULL) {
if (CurrentScriptFile->CurrentCommand->Reset) { Info = (SHELL_FOR_INFO*)CurrentScriptFile->CurrentCommand->Data;
Info->CurrentValue = (CHAR16*)Info->Set; if (CurrentScriptFile->CurrentCommand->Reset) {
FirstPass = TRUE; Info->CurrentValue = (CHAR16*)Info->Set;
CurrentScriptFile->CurrentCommand->Reset = FALSE; FirstPass = TRUE;
CurrentScriptFile->CurrentCommand->Reset = FALSE;
}
} else {
ShellStatus = SHELL_UNSUPPORTED;
Info = NULL;
} }
if (ShellStatus == SHELL_SUCCESS) { if (ShellStatus == SHELL_SUCCESS) {
ASSERT(Info != NULL); ASSERT(Info != NULL);