]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Update code to ensure the pointer ‘CurrentName’ in function ‘PerformSingleMappingDisp...
authorShumin Qiu <shumin.qiu@intel.com>
Tue, 17 Dec 2013 01:04:38 +0000 (01:04 +0000)
committershenshushi <shenshushi@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 17 Dec 2013 01:04:38 +0000 (01:04 +0000)
Signed-off-by: Shumin Qiu <shumin.qiu@intel.com>
Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14990 6f19259b-4bc3-4df7-8a09-765794883524

ShellPkg/Library/UefiShellLevel2CommandsLib/Map.c

index 590dbf79e34f2bb3451a3a659178e752268c740a..9e33286c90db5f16f742e922519a6661c229481c 100644 (file)
@@ -468,6 +468,9 @@ PerformSingleMappingDisplay(
       }\r
     } else {\r
       Alias = StrnCatGrow(&Alias, 0, MapList, 0);\r
+      if (Alias == NULL) {\r
+        return EFI_OUT_OF_RESOURCES;\r
+      }\r
       TempSpot = StrStr(Alias, CurrentName);\r
       if (TempSpot != NULL) {\r
         TempSpot2 = StrStr(TempSpot, L";");\r
@@ -484,6 +487,10 @@ PerformSingleMappingDisplay(
     }\r
   } else {\r
     CurrentName = NULL;\r
+    CurrentName = StrnCatGrow(&CurrentName, 0, L"", 0);\r
+    if (CurrentName == NULL) {\r
+      return (EFI_OUT_OF_RESOURCES);\r
+    }\r
   }\r
   DevPathString = ConvertDevicePathToText(DevPath, TRUE, FALSE);\r
   if (!SFO) {\r