Revision: 14128
http://edk2.svn.sourceforge.net/edk2/?rev=14128&view=rev
Author: jcarsey
Date: 2013-02-13 22:22:16 +0000 (Wed, 13 Feb 2013)
Log Message:
-----------
ShellPkg: add verification that a target directory exists when changing
directory with drive identifier.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey <[email protected]>
reviewed-by: Erik Bjorge <[email protected]>
Modified Paths:
--------------
trunk/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Cd.c
Modified: trunk/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Cd.c
===================================================================
--- trunk/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Cd.c 2013-02-08
21:34:26 UTC (rev 14127)
+++ trunk/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Cd.c 2013-02-13
22:22:16 UTC (rev 14128)
@@ -1,7 +1,7 @@
/** @file
Main file for attrib shell level 2 function.
- Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2009 - 2013, Intel Corporation. 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
@@ -149,6 +149,9 @@
}
}
} else if (StrStr(Param1Copy, L":") == NULL) {
+ //
+ // change directory without a drive identifier
+ //
if (ShellGetCurrentDir(NULL) == NULL) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_CWD),
gShellLevel2HiiHandle);
ShellStatus = SHELL_NOT_FOUND;
@@ -189,7 +192,7 @@
}
} else {
//
- // change directory on other drive letter
+ // change directory with a drive letter
//
Drive = AllocateZeroPool(StrSize(Param1Copy));
if (Drive == NULL) {
@@ -199,7 +202,10 @@
Drive = StrCpy(Drive, Param1Copy);
Path = StrStr(Drive, L":");
ASSERT(Path != NULL);
- if (*(Path+1) == CHAR_NULL) {
+ if (EFI_ERROR(ShellIsDirectory(Param1Copy))) {
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NOT_DIR),
gShellLevel2HiiHandle, Param1Copy);
+ ShellStatus = SHELL_NOT_FOUND;
+ } else if (*(Path+1) == CHAR_NULL) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_CD_NF),
gShellLevel2HiiHandle);
ShellStatus = SHELL_NOT_FOUND;
} else {
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits