diff options
author | jcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-09-20 23:06:23 +0000 |
---|---|---|
committer | jcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-09-20 23:06:23 +0000 |
commit | eca218a7cee77c255ee5992590e8e4bb1c20a662 (patch) | |
tree | 3a276cfd73a93c8697f86dac75db98c5131c59e8 | |
parent | 1fc3749dad42e8d5caebf6e0e0327b713b6adaeb (diff) | |
download | edk2-eca218a7cee77c255ee5992590e8e4bb1c20a662.tar.gz edk2-eca218a7cee77c255ee5992590e8e4bb1c20a662.tar.bz2 edk2-eca218a7cee77c255ee5992590e8e4bb1c20a662.zip |
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
-rw-r--r-- | ShellPkg/Library/UefiSortLib/UefiSortLib.c | 19 |
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);
}
|