ShellPkg: Add checking for memory allocation and pointer returns from functions.

signed-off-by: jcarsey
reviewed-by: geekboy15a

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12540 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jcarsey
2011-10-14 19:21:13 +00:00
parent de2a15eebb
commit 532691c8ba
15 changed files with 253 additions and 168 deletions

View File

@@ -414,6 +414,9 @@ PerformSingleMappingDisplay(
CurrentName = NULL;
CurrentName = StrnCatGrow(&CurrentName, 0, MapList, 0);
if (CurrentName == NULL) {
return (EFI_OUT_OF_RESOURCES);
}
TempSpot = StrStr(CurrentName, L";");
if (TempSpot != NULL) {
*TempSpot = CHAR_NULL;

View File

@@ -642,10 +642,15 @@ CheckAndSetTimeZone (
}
Status = gRT->GetTime(&TheTime, NULL);
ASSERT_EFI_ERROR(Status);
if (EFI_ERROR(Status)) {
return (SHELL_DEVICE_ERROR);
}
TimeZoneCopy = NULL;
TimeZoneCopy = StrnCatGrow(&TimeZoneCopy, NULL, TimeZoneString, 0);
if (TimeZoneCopy == NULL) {
return (SHELL_OUT_OF_RESOURCES);
}
Walker = TimeZoneCopy;
Walker2 = StrStr(Walker, L":");
if (Walker2 != NULL && *Walker2 == L':') {

View File

@@ -226,6 +226,10 @@ VerifyIntermediateDirectories (
PathCopy = StrnCatGrow(&PathCopy, NULL, Path, 0);
FileHandle = NULL;
if (PathCopy == NULL) {
return (EFI_OUT_OF_RESOURCES);
}
for (TempSpot = &PathCopy[StrLen(PathCopy)-1] ; *TempSpot != CHAR_NULL && *TempSpot != L'\\' ; TempSpot = &PathCopy[StrLen(PathCopy)-1]){
*TempSpot = CHAR_NULL;
}