public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] ShellPkg-Cd: Ensure all valid cd targets are handled properly
@ 2018-10-04 16:46 Jim.Dailey
  2018-10-08 14:53 ` Carsey, Jaben
  0 siblings, 1 reply; 3+ messages in thread
From: Jim.Dailey @ 2018-10-04 16:46 UTC (permalink / raw)
  To: edk2-devel; +Cc: jaben.carsey, ruiyu.ni

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>
---
 ShellPkg/Library/UefiShellLevel2CommandsLib/Cd.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

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



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-10-12  5:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-04 16:46 [PATCH] ShellPkg-Cd: Ensure all valid cd targets are handled properly Jim.Dailey
2018-10-08 14:53 ` Carsey, Jaben
2018-10-12  5:46   ` Ni, Ruiyu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox