diff options
author | jcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-10-14 19:21:13 +0000 |
---|---|---|
committer | jcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-10-14 19:21:13 +0000 |
commit | 532691c8ba90e5022174503ab0781322c6f79cab (patch) | |
tree | 7c598451898c979b99cdfa0ec1573d509d5ee1ff /ShellPkg/Application/Shell/ShellManParser.c | |
parent | de2a15eebbf467c335f3e28ff0ba0ca6dd0ddcf2 (diff) | |
download | edk2-platforms-532691c8ba90e5022174503ab0781322c6f79cab.tar.xz |
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
Diffstat (limited to 'ShellPkg/Application/Shell/ShellManParser.c')
-rw-r--r-- | ShellPkg/Application/Shell/ShellManParser.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/ShellPkg/Application/Shell/ShellManParser.c b/ShellPkg/Application/Shell/ShellManParser.c index bd2efcb423..470f51a8ea 100644 --- a/ShellPkg/Application/Shell/ShellManParser.c +++ b/ShellPkg/Application/Shell/ShellManParser.c @@ -180,6 +180,10 @@ ManBufferFindSections( TempString2 = MIN(TempString2, StrStr(CurrentLocation, L"\n"));
ASSERT(TempString == NULL);
TempString = StrnCatGrow(&TempString, NULL, CurrentLocation, TempString2==NULL?0:TempString2 - CurrentLocation);
+ if (TempString == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
+ break;
+ }
SectionName = TempString;
SectionLen = StrLen(SectionName);
SectionName = StrStr(Sections, SectionName);
@@ -197,12 +201,24 @@ ManBufferFindSections( TempString2 = MIN(TempString2, StrStr(CurrentLocation, L"\n"));
ASSERT(TempString == NULL);
TempString = StrnCatGrow(&TempString, NULL, CurrentLocation, TempString2==NULL?0:TempString2 - CurrentLocation);
+ if (TempString == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
+ break;
+ }
//
// copy and save the current line.
//
ASSERT((*HelpText == NULL && *HelpSize == 0) || (*HelpText != NULL));
StrnCatGrow (HelpText, HelpSize, TempString, 0);
+ if (HelpText == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
+ break;
+ }
StrnCatGrow (HelpText, HelpSize, L"\r\n", 0);
+ if (HelpText == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
+ break;
+ }
}
}
SHELL_FREE_NON_NULL(TempString);
|