// Reset page break back to default.\r
//\r
ShellInfoObject.PageBreakEnabled = PcdGetBool(PcdShellPageBreakDefault);\r
+ ASSERT (ShellInfoObject.ConsoleInfo != NULL);\r
ShellInfoObject.ConsoleInfo->Enabled = TRUE;\r
ShellInfoObject.ConsoleInfo->RowCounter = 0;\r
\r
if (EFI_ERROR(Status)) {\r
return (Status);\r
}\r
+ ASSERT (*CmdLine != NULL);\r
\r
TrimSpaces(CmdLine);\r
\r
ASSERT((PathForReturn == NULL && PathSize == 0) || (PathForReturn != NULL));\r
\r
AlignedNode = AllocateCopyPool (DevicePathNodeLength(FilePath), FilePath);\r
+ ASSERT (AlignedNode != NULL);\r
\r
// File Path Device Path Nodes 'can optionally add a "\" separator to\r
// the beginning and/or the end of the Path Name string.'\r
/** @file\r
Main file for bcfg shell Debug1 function.\r
\r
- Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
Buffer);\r
if (Status == EFI_BUFFER_TOO_SMALL) {\r
Buffer = AllocateZeroPool(BufferSize);\r
- Status = gRT->GetVariable(\r
- VariableName,\r
- (EFI_GUID*)&gEfiGlobalVariableGuid,\r
- NULL,\r
- &BufferSize,\r
- Buffer);\r
+ if (Buffer != NULL) {\r
+ Status = gRT->GetVariable(\r
+ VariableName,\r
+ (EFI_GUID*)&gEfiGlobalVariableGuid,\r
+ NULL,\r
+ &BufferSize,\r
+ Buffer);\r
+ }\r
}\r
\r
if (EFI_ERROR(Status) || Buffer == NULL) {\r
\r
if ((*(UINT16*)(Buffer+4)) != 0) {\r
DevPath = AllocateZeroPool(*(UINT16*)(Buffer+4));\r
- CopyMem(DevPath, Buffer+6+StrSize((CHAR16*)(Buffer+6)), *(UINT16*)(Buffer+4));\r
- DevPathString = ConvertDevicePathToText(DevPath, TRUE, FALSE);\r
+ if (DevPath != NULL) {\r
+ CopyMem(DevPath, Buffer+6+StrSize((CHAR16*)(Buffer+6)), *(UINT16*)(Buffer+4));\r
+ DevPathString = ConvertDevicePathToText(DevPath, TRUE, FALSE);\r
+ } else {\r
+ DevPathString = NULL;\r
+ }\r
} else {\r
DevPath = NULL;\r
DevPathString = NULL;\r
CurrentOperation.Order);\r
if (Status == EFI_BUFFER_TOO_SMALL) {\r
CurrentOperation.Order = AllocateZeroPool(Length+(4*sizeof(CurrentOperation.Order[0])));\r
- Status = gRT->GetVariable(\r
- CurrentOperation.Target == BcfgTargetBootOrder?(CHAR16*)L"BootOrder":(CHAR16*)L"DriverOrder",\r
- (EFI_GUID*)&gEfiGlobalVariableGuid,\r
- NULL,\r
- &Length,\r
- CurrentOperation.Order);\r
+ if (CurrentOperation.Order != NULL) {\r
+ Status = gRT->GetVariable(\r
+ CurrentOperation.Target == BcfgTargetBootOrder?(CHAR16*)L"BootOrder":(CHAR16*)L"DriverOrder",\r
+ (EFI_GUID*)&gEfiGlobalVariableGuid,\r
+ NULL,\r
+ &Length,\r
+ CurrentOperation.Order);\r
+ } else {\r
+ ShellStatus = SHELL_OUT_OF_RESOURCES;\r
+ }\r
}\r
}\r
\r
/** @file\r
Implements filebuffer interface functions.\r
\r
- Copyright (c) 2005 - 2012, Intel Corporation. All rights reserved. <BR>\r
+ Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved. <BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
\r
CHAR16 *Buffer;\r
UINTN Limit;\r
- CHAR16 PrintLine[200];\r
- CHAR16 PrintLine2[250];\r
+ CHAR16 *PrintLine;\r
+ CHAR16 *PrintLine2;\r
+ UINTN BufLen; \r
\r
//\r
// print start from correct character\r
Limit = 0;\r
}\r
\r
- StrnCpy (PrintLine, Buffer, MIN(MIN(Limit,MainEditor.ScreenSize.Column), 200));\r
+ BufLen = (MainEditor.ScreenSize.Column + 1) * sizeof (CHAR16);\r
+ PrintLine = AllocatePool (BufLen);\r
+ ASSERT (PrintLine != NULL);\r
+\r
+ StrnCpy (PrintLine, Buffer, MIN(Limit, MainEditor.ScreenSize.Column));\r
for (; Limit < MainEditor.ScreenSize.Column; Limit++) {\r
PrintLine[Limit] = L' ';\r
}\r
\r
PrintLine[MainEditor.ScreenSize.Column] = CHAR_NULL;\r
- ShellCopySearchAndReplace(PrintLine, PrintLine2, 250, L"%", L"^%", FALSE, FALSE);\r
+\r
+ PrintLine2 = AllocatePool (BufLen * 2);\r
+ ASSERT (PrintLine2 != NULL);\r
+\r
+ ShellCopySearchAndReplace(PrintLine, PrintLine2, BufLen * 2, L"%", L"^%", FALSE, FALSE);\r
\r
ShellPrintEx (\r
0,\r
PrintLine2\r
);\r
\r
+ FreePool (PrintLine);\r
+ FreePool (PrintLine2);\r
+\r
return EFI_SUCCESS;\r
}\r
\r
/** @file\r
Main file for Mm shell Debug1 function.\r
\r
- Copyright (c) 2005 - 2013, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
SHELL_STATUS ShellStatus;\r
CONST CHAR16 *Temp;\r
\r
+ Value = 0;\r
Address = 0;\r
PciEAddress = 0;\r
IoDev = NULL;\r
/** @file\r
Main file for bcfg shell Install1 function.\r
\r
- Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
\r
if ((*(UINT16*)(Buffer+4)) != 0) {\r
DevPath = AllocateZeroPool(*(UINT16*)(Buffer+4));\r
- CopyMem(DevPath, Buffer+6+StrSize((CHAR16*)(Buffer+6)), *(UINT16*)(Buffer+4));\r
- DevPathString = ConvertDevicePathToText(DevPath, TRUE, FALSE);\r
+ if (DevPath == NULL) {\r
+ DevPathString = NULL;\r
+ } else {\r
+ CopyMem(DevPath, Buffer+6+StrSize((CHAR16*)(Buffer+6)), *(UINT16*)(Buffer+4));\r
+ DevPathString = ConvertDevicePathToText(DevPath, TRUE, FALSE);\r
+ }\r
} else {\r
DevPath = NULL;\r
DevPathString = NULL;\r
CurrentOperation.Order);\r
if (Status == EFI_BUFFER_TOO_SMALL) {\r
CurrentOperation.Order = AllocateZeroPool(Length+(4*sizeof(CurrentOperation.Order[0])));\r
- Status = gRT->GetVariable(\r
- CurrentOperation.Target == BcfgTargetBootOrder?(CHAR16*)L"BootOrder":(CHAR16*)L"DriverOrder",\r
- (EFI_GUID*)&gEfiGlobalVariableGuid,\r
- NULL,\r
- &Length,\r
- CurrentOperation.Order);\r
+ if (CurrentOperation.Order == NULL) {\r
+ ShellStatus = SHELL_OUT_OF_RESOURCES;\r
+ } else {\r
+ Status = gRT->GetVariable(\r
+ CurrentOperation.Target == BcfgTargetBootOrder?(CHAR16*)L"BootOrder":(CHAR16*)L"DriverOrder",\r
+ (EFI_GUID*)&gEfiGlobalVariableGuid,\r
+ NULL,\r
+ &Length,\r
+ CurrentOperation.Order);\r
+ }\r
}\r
}\r
\r
/** @file\r
Main file for endfor and for shell level 1 functions.\r
\r
- Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
CurrentScriptFile = ShellCommandGetCurrentScriptFile();\r
ASSERT(CurrentScriptFile != NULL);\r
\r
- if (CurrentScriptFile->CurrentCommand->Data == NULL) {\r
+ if ((CurrentScriptFile->CurrentCommand != NULL) && (CurrentScriptFile->CurrentCommand->Data == NULL)) {\r
FirstPass = TRUE;\r
\r
//\r
gShellLevel1HiiHandle, \r
L"EndFor", \r
L"For", \r
- CurrentScriptFile->CurrentCommand!=NULL\r
- ?CurrentScriptFile->CurrentCommand->Line:0);\r
+ CurrentScriptFile->CurrentCommand->Line);\r
return (SHELL_DEVICE_ERROR);\r
}\r
\r
STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), \r
gShellLevel1HiiHandle, \r
ArgSet, \r
- CurrentScriptFile!=NULL \r
- && CurrentScriptFile->CurrentCommand!=NULL\r
- ? CurrentScriptFile->CurrentCommand->Line:0);\r
+ CurrentScriptFile->CurrentCommand->Line);\r
ShellStatus = SHELL_INVALID_PARAMETER;\r
} else {\r
TempSpot = StrStr(ArgSetWalker, L")");\r
NULL, \r
STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), \r
gShellLevel1HiiHandle, \r
- CurrentScriptFile!=NULL \r
- && CurrentScriptFile->CurrentCommand!=NULL\r
- ? CurrentScriptFile->CurrentCommand->Line:0);\r
+ CurrentScriptFile->CurrentCommand->Line);\r
ShellStatus = SHELL_INVALID_PARAMETER;\r
} else {\r
*TempSpot = CHAR_NULL;\r
STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), \r
gShellLevel1HiiHandle, \r
ArgSet, \r
- CurrentScriptFile!=NULL \r
- && CurrentScriptFile->CurrentCommand!=NULL\r
- ? CurrentScriptFile->CurrentCommand->Line:0);\r
+ CurrentScriptFile->CurrentCommand->Line);\r
ShellStatus = SHELL_INVALID_PARAMETER;\r
} else {\r
if (ArgSetWalker[0] == L'-') {\r
STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), \r
gShellLevel1HiiHandle, \r
ArgSet, \r
- CurrentScriptFile!=NULL \r
- && CurrentScriptFile->CurrentCommand!=NULL\r
- ? CurrentScriptFile->CurrentCommand->Line:0);\r
+ CurrentScriptFile->CurrentCommand->Line);\r
ShellStatus = SHELL_INVALID_PARAMETER;\r
} else {\r
if (ArgSetWalker[0] == L'-') {\r
STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), \r
gShellLevel1HiiHandle, \r
ArgSet, \r
- CurrentScriptFile!=NULL \r
- && CurrentScriptFile->CurrentCommand!=NULL\r
- ? CurrentScriptFile->CurrentCommand->Line:0);\r
+ CurrentScriptFile->CurrentCommand->Line);\r
ShellStatus = SHELL_INVALID_PARAMETER;\r
} else {\r
if (*ArgSetWalker == L')') {\r
STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), \r
gShellLevel1HiiHandle, \r
ArgSet, \r
- CurrentScriptFile!=NULL \r
- && CurrentScriptFile->CurrentCommand!=NULL\r
- ? CurrentScriptFile->CurrentCommand->Line:0);\r
+ CurrentScriptFile->CurrentCommand->Line);\r
ShellStatus = SHELL_INVALID_PARAMETER;\r
}\r
}\r