]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ShellPkg-Cd: Ensure all valid cd targets are handled properly
authorJim.Dailey@dell.com <Jim.Dailey@dell.com>
Thu, 4 Oct 2018 16:46:39 +0000 (00:46 +0800)
committerRuiyu Ni <ruiyu.ni@intel.com>
Fri, 12 Oct 2018 05:45:34 +0000 (13:45 +0800)
ShellPkg-Cd: Ensure all valid cd targets are handled properly

Make sure that PathCleanUpDirectories() is called on all valid targets
of the cd command.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jim Dailey <jim_dailey@dell.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
ShellPkg/Library/UefiShellLevel2CommandsLib/Cd.c

index 79dd2096f49b3a4765078f9d2730a924c1468db9..1eb7056aee5eaffcaadb9075c3e5aabd86256162 100644 (file)
@@ -4,6 +4,7 @@
   (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
   (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>\r
   Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2018, Dell Technologies. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -261,9 +262,6 @@ ShellCommandRunCd (
 \r
         if (Param1Copy != NULL && IsCurrentFileSystem (Param1Copy, Cwd)) {\r
           Status = ReplaceDriveWithCwd (&Param1Copy,Cwd);\r
-          if (!EFI_ERROR (Status)) {\r
-            Param1Copy = PathCleanUpDirectories (Param1Copy);\r
-          }\r
         } else {\r
           //\r
           // Can't use cd command to change filesystem.\r
@@ -302,13 +300,15 @@ ShellCommandRunCd (
                 StrCatS (TempBuffer, TotalSize / sizeof (CHAR16), Param1Copy);\r
 \r
                 FreePool (Param1Copy);\r
-                Param1Copy = PathCleanUpDirectories (TempBuffer);\r
+                Param1Copy = TempBuffer;\r
+                TempBuffer = NULL;\r
               }\r
             }\r
           }\r
         }\r
 \r
         if (!EFI_ERROR(Status)) {\r
+          Param1Copy = PathCleanUpDirectories (Param1Copy);\r
           Status = ExtractDriveAndPath (Param1Copy, &Drive, &Path);\r
         }\r
 \r