]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.c
1.Add code to check the pointer 'CorrectedPath' in Ls.c line 460 before referenced...
[mirror_edk2.git] / ShellPkg / Library / UefiShellLevel2CommandsLib / UefiShellLevel2CommandsLib.c
index 6bdc39f08b9ecdb5989d86925ac5f88d935c30c5..fe8765f21448c577fc6da84ae7a5f8e63b5af7ae 100644 (file)
@@ -22,7 +22,7 @@
   * functions are non-interactive only\r
 \r
 \r
-  Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2014, Intel Corporation. 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
@@ -93,7 +93,7 @@ ShellLevel2CommandsLibConstructor (
   ShellCommandRegisterCommandName(L"mv",       ShellCommandRunMv      , ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_MV)     );\r
   ShellCommandRegisterCommandName(L"parse",    ShellCommandRunParse   , ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_PARSE)  );\r
   ShellCommandRegisterCommandName(L"reset",    ShellCommandRunReset   , ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_RESET)  );\r
-  ShellCommandRegisterCommandName(L"set",      ShellCommandRunSet     , ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_SET)    );\r
+  ShellCommandRegisterCommandName(L"set",      ShellCommandRunSet     , ShellCommandGetManFileNameLevel2, 2, L"",FALSE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_SET)    );\r
   ShellCommandRegisterCommandName(L"ls",       ShellCommandRunLs      , ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_LS)     );\r
   ShellCommandRegisterCommandName(L"rm",       ShellCommandRunRm      , ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_RM)     );\r
   ShellCommandRegisterCommandName(L"vol",      ShellCommandRunVol     , ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_VOL)    );\r
@@ -163,8 +163,8 @@ ShellLevel2CommandsLibDestructor (
   @param[in] Path         The unknown Path Value\r
 \r
   @retval NULL            A memory allocation failed\r
-  @retval NULL            a fully qualified path could not be discovered.\r
-  @retval other           pointer to a fuly qualified path.\r
+  @retval NULL            A fully qualified path could not be discovered.\r
+  @retval other           An allocated pointer to a fuly qualified path.\r
 **/\r
 CHAR16*\r
 EFIAPI\r
@@ -194,6 +194,10 @@ GetFullyQualifiedPath(
 \r
   PathCleanUpDirectories(PathToReturn);\r
 \r
+  if (PathToReturn == NULL) {\r
+    return NULL;\r
+  }\r
+\r
   while (PathToReturn[StrLen(PathToReturn)-1] == L'*') {\r
     PathToReturn[StrLen(PathToReturn)-1] = CHAR_NULL;\r
   }\r
@@ -226,6 +230,10 @@ VerifyIntermediateDirectories (
   PathCopy    = StrnCatGrow(&PathCopy, NULL, Path, 0);\r
   FileHandle  = NULL;\r
 \r
+  if (PathCopy == NULL) {\r
+    return (EFI_OUT_OF_RESOURCES);\r
+  }\r
+\r
   for (TempSpot = &PathCopy[StrLen(PathCopy)-1] ; *TempSpot != CHAR_NULL && *TempSpot != L'\\' ; TempSpot = &PathCopy[StrLen(PathCopy)-1]){\r
     *TempSpot = CHAR_NULL;\r
   }\r