summaryrefslogtreecommitdiff
path: root/ShellPkg/Library/UefiSortLib
diff options
context:
space:
mode:
authorjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>2011-09-20 23:06:23 +0000
committerjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>2011-09-20 23:06:23 +0000
commiteca218a7cee77c255ee5992590e8e4bb1c20a662 (patch)
tree3a276cfd73a93c8697f86dac75db98c5131c59e8 /ShellPkg/Library/UefiSortLib
parent1fc3749dad42e8d5caebf6e0e0327b713b6adaeb (diff)
downloadedk2-platforms-eca218a7cee77c255ee5992590e8e4bb1c20a662.tar.xz
ShellPkg: Verify DevicePathToText was successful before using the resultant pointer.
signed-off-by: jcarsey reviewed-by: darylm503 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12393 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ShellPkg/Library/UefiSortLib')
-rw-r--r--ShellPkg/Library/UefiSortLib/UefiSortLib.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/ShellPkg/Library/UefiSortLib/UefiSortLib.c b/ShellPkg/Library/UefiSortLib/UefiSortLib.c
index 73ee7830fc..9cff46d4e6 100644
--- a/ShellPkg/Library/UefiSortLib/UefiSortLib.c
+++ b/ShellPkg/Library/UefiSortLib/UefiSortLib.c
@@ -13,6 +13,7 @@
**/
#include <Uefi.h>
+#include <ShellBase.h>
#include <Protocol/UnicodeCollation.h>
#include <Protocol/DevicePath.h>
@@ -251,13 +252,19 @@ DevicePathCompare (
FALSE,
FALSE);
- RetVal = mUnicodeCollation->StriColl(
- mUnicodeCollation,
- TextPath1,
- TextPath2);
+ if (TextPath1 == NULL) {
+ RetVal = -1;
+ } else if (TextPath2 == NULL) {
+ RetVal = 1;
+ } else {
+ RetVal = mUnicodeCollation->StriColl(
+ mUnicodeCollation,
+ TextPath1,
+ TextPath2);
+ }
- FreePool(TextPath1);
- FreePool(TextPath2);
+ SHELL_FREE_NON_NULL(TextPath1);
+ SHELL_FREE_NON_NULL(TextPath2);
return (RetVal);
}