diff options
author | sfu5 <sfu5@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-10-08 02:55:30 +0000 |
---|---|---|
committer | sfu5 <sfu5@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-10-08 02:55:30 +0000 |
commit | 02a758cb0b5bc8775d95e0a52acc483f850124a1 (patch) | |
tree | 97021cedc2e4bf82766ce9a5f74c4beaf345833d /ShellPkg | |
parent | 4bc6ad3935d7b57e5eacda5e6e70b32d786d43dd (diff) | |
download | edk2-platforms-02a758cb0b5bc8775d95e0a52acc483f850124a1.tar.xz |
Add pointer check for NULL before dereference it.
Signed-off-by: sfu5
Reviewed-by: xdu2
Reviewed-by: ydong10
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12514 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ShellPkg')
-rw-r--r-- | ShellPkg/Library/UefiFileHandleLib/UefiFileHandleLib.c | 3 | ||||
-rw-r--r-- | ShellPkg/Library/UefiShellLib/UefiShellLib.c | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/ShellPkg/Library/UefiFileHandleLib/UefiFileHandleLib.c b/ShellPkg/Library/UefiFileHandleLib/UefiFileHandleLib.c index a4820c9970..116c78f38b 100644 --- a/ShellPkg/Library/UefiFileHandleLib/UefiFileHandleLib.c +++ b/ShellPkg/Library/UefiFileHandleLib/UefiFileHandleLib.c @@ -765,6 +765,9 @@ StrnCatGrowLeft ( } else {
*Destination = AllocateZeroPool(Count+sizeof(CHAR16));
}
+ if (*Destination == NULL) {
+ return NULL;
+ }
CopySize = StrSize(*Destination);
CopyMem((*Destination)+((Count-2)/sizeof(CHAR16)), *Destination, CopySize);
diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c b/ShellPkg/Library/UefiShellLib/UefiShellLib.c index 598a2b479a..06e2386378 100644 --- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c +++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c @@ -1933,6 +1933,9 @@ InternalCommandLineParse ( // initialize the linked list
//
*CheckPackage = (LIST_ENTRY*)AllocateZeroPool(sizeof(LIST_ENTRY));
+ if (*CheckPackage == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
InitializeListHead(*CheckPackage);
//
|