check memory allocations for success.
check pointer before access. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11503 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -2760,7 +2760,7 @@ FileBufferMovePosition (
|
|||||||
//
|
//
|
||||||
FileBuffer.FilePosition.Column = NewFilePosCol;
|
FileBuffer.FilePosition.Column = NewFilePosCol;
|
||||||
if (ColGap < 0) {
|
if (ColGap < 0) {
|
||||||
Abs = -ColGap;
|
Abs = (UINTN)(-ColGap);
|
||||||
FileBuffer.DisplayPosition.Column -= Abs;
|
FileBuffer.DisplayPosition.Column -= Abs;
|
||||||
} else {
|
} else {
|
||||||
FileBuffer.DisplayPosition.Column += ColGap;
|
FileBuffer.DisplayPosition.Column += ColGap;
|
||||||
|
@ -205,6 +205,10 @@ ShellCommandRunSetVar (
|
|||||||
Data++;
|
Data++;
|
||||||
Data++;
|
Data++;
|
||||||
Buffer = AllocateZeroPool(StrSize(Data));
|
Buffer = AllocateZeroPool(StrSize(Data));
|
||||||
|
if (Buffer == NULL) {
|
||||||
|
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellDebug1HiiHandle);
|
||||||
|
ShellStatus = SHELL_OUT_OF_RESOURCES;
|
||||||
|
} else {
|
||||||
UnicodeSPrint(Buffer, StrSize(Data), L"%s", Data);
|
UnicodeSPrint(Buffer, StrSize(Data), L"%s", Data);
|
||||||
((CHAR16*)Buffer)[StrLen(Buffer)-1] = CHAR_NULL;
|
((CHAR16*)Buffer)[StrLen(Buffer)-1] = CHAR_NULL;
|
||||||
|
|
||||||
@ -215,6 +219,7 @@ ShellCommandRunSetVar (
|
|||||||
} else {
|
} else {
|
||||||
ASSERT(ShellStatus == SHELL_SUCCESS);
|
ASSERT(ShellStatus == SHELL_SUCCESS);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else if (StrnCmp(Data, L"--", 2) == 0) {
|
} else if (StrnCmp(Data, L"--", 2) == 0) {
|
||||||
//
|
//
|
||||||
// device path in text format
|
// device path in text format
|
||||||
|
@ -565,7 +565,9 @@ ShellCommandRunFor (
|
|||||||
Info->RemoveSubstAlias = TRUE;
|
Info->RemoveSubstAlias = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (CurrentScriptFile->CurrentCommand != NULL) {
|
||||||
CurrentScriptFile->CurrentCommand->Data = Info;
|
CurrentScriptFile->CurrentCommand->Data = Info;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ShellPrintHiiEx(
|
ShellPrintHiiEx(
|
||||||
-1,
|
-1,
|
||||||
|
Binary file not shown.
@ -113,7 +113,12 @@ HandleVol(
|
|||||||
Size2 = StrSize(SysInfo->VolumeLabel);
|
Size2 = StrSize(SysInfo->VolumeLabel);
|
||||||
if (Size1 > Size2) {
|
if (Size1 > Size2) {
|
||||||
SysInfo = ReallocatePool((UINTN)SysInfo->Size, (UINTN)SysInfo->Size + Size1 - Size2, SysInfo);
|
SysInfo = ReallocatePool((UINTN)SysInfo->Size, (UINTN)SysInfo->Size + Size1 - Size2, SysInfo);
|
||||||
|
if (SysInfo == NULL) {
|
||||||
|
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellLevel2HiiHandle);
|
||||||
|
ShellStatus = SHELL_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (SysInfo != NULL) {
|
||||||
StrCpy ((CHAR16 *) SysInfo->VolumeLabel, Name);
|
StrCpy ((CHAR16 *) SysInfo->VolumeLabel, Name);
|
||||||
SysInfo->Size = SIZE_OF_EFI_FILE_SYSTEM_INFO + Size1;
|
SysInfo->Size = SIZE_OF_EFI_FILE_SYSTEM_INFO + Size1;
|
||||||
Status = EfiFpHandle->SetInfo(
|
Status = EfiFpHandle->SetInfo(
|
||||||
@ -122,6 +127,7 @@ HandleVol(
|
|||||||
(UINTN)SysInfo->Size,
|
(UINTN)SysInfo->Size,
|
||||||
SysInfo);
|
SysInfo);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
FreePool(SysInfo);
|
FreePool(SysInfo);
|
||||||
|
|
||||||
@ -154,6 +160,7 @@ HandleVol(
|
|||||||
|
|
||||||
ASSERT(SysInfo != NULL);
|
ASSERT(SysInfo != NULL);
|
||||||
|
|
||||||
|
if (SysInfo != NULL) {
|
||||||
//
|
//
|
||||||
// print VolumeInfo table
|
// print VolumeInfo table
|
||||||
//
|
//
|
||||||
@ -170,6 +177,7 @@ HandleVol(
|
|||||||
SysInfo->BlockSize
|
SysInfo->BlockSize
|
||||||
);
|
);
|
||||||
SHELL_FREE_NON_NULL(SysInfo);
|
SHELL_FREE_NON_NULL(SysInfo);
|
||||||
|
}
|
||||||
|
|
||||||
return (ShellStatus);
|
return (ShellStatus);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user