]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellLevel2CommandsLib/Reset.c
ShellPkg: Fix buffer overflow issue in 'map' command.
[mirror_edk2.git] / ShellPkg / Library / UefiShellLevel2CommandsLib / Reset.c
index d0eea8d0337d430b69c6787a6bd0cc14072162c2..7d4cfb470e8d50b6ce98372c25849b7f34d6e638 100644 (file)
@@ -1,7 +1,8 @@
 /** @file\r
   Main file for attrib shell level 2 function.\r
 \r
-  Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
+  (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>\r
+  Copyright (c) 2009 - 2012, 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
@@ -55,7 +56,7 @@ ShellCommandRunReset (
   Status = ShellCommandLineParse (ResetParamList, &Package, &ProblemParam, TRUE);\r
   if (EFI_ERROR(Status)) {\r
     if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {\r
-      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, ProblemParam);\r
+      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"reset", ProblemParam);  \r
       FreePool(ProblemParam);\r
       return (SHELL_INVALID_PARAMETER);\r
     } else {\r
@@ -68,27 +69,27 @@ ShellCommandRunReset (
     if (ShellCommandLineGetFlag(Package, L"-?")) {\r
       ASSERT(FALSE);\r
     } else if (ShellCommandLineGetRawValue(Package, 1) != NULL) {\r
-      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle);\r
+      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"reset");  \r
       ShellStatus = SHELL_INVALID_PARAMETER;\r
     } else {\r
       //\r
-      // check for cold reset flag, then shutdown reset flag, then warm (default) reset flag\r
+      // check for warm reset flag, then shutdown reset flag, then cold (default) reset flag\r
       //\r
-      if (ShellCommandLineGetFlag(Package, L"-c")) {\r
-        if (ShellCommandLineGetFlag(Package, L"-s") || ShellCommandLineGetFlag(Package, L"-w")) {\r
-          ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle);\r
+      if (ShellCommandLineGetFlag(Package, L"-w")) {\r
+        if (ShellCommandLineGetFlag(Package, L"-s") || ShellCommandLineGetFlag(Package, L"-c")) {\r
+          ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"reset");  \r
           ShellStatus = SHELL_INVALID_PARAMETER;\r
         } else {\r
-          String = ShellCommandLineGetValue(Package, L"-c");\r
+          String = ShellCommandLineGetValue(Package, L"-w");\r
           if (String != NULL) {\r
-            gRT->ResetSystem(EfiResetCold, EFI_SUCCESS, StrSize(String), (VOID*)String);\r
+            gRT->ResetSystem(EfiResetWarm, EFI_SUCCESS, StrSize(String), (VOID*)String);\r
           } else {\r
-            gRT->ResetSystem(EfiResetCold, EFI_SUCCESS, 0, NULL);\r
+            gRT->ResetSystem(EfiResetWarm, EFI_SUCCESS, 0, NULL);\r
           }\r
         }\r
       } else if (ShellCommandLineGetFlag(Package, L"-s")) {\r
-        if (ShellCommandLineGetFlag(Package, L"-w")) {\r
-          ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle);\r
+        if (ShellCommandLineGetFlag(Package, L"-c")) {\r
+          ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"reset");  \r
           ShellStatus = SHELL_INVALID_PARAMETER;\r
         } else {\r
           String = ShellCommandLineGetValue(Package, L"-s");\r
@@ -103,11 +104,11 @@ ShellCommandRunReset (
         //\r
         // this is default so dont worry about flag...\r
         //\r
-        String = ShellCommandLineGetValue(Package, L"-w");\r
+        String = ShellCommandLineGetValue(Package, L"-c");\r
         if (String != NULL) {\r
-          gRT->ResetSystem(EfiResetWarm, EFI_SUCCESS, StrSize(String), (VOID*)String);\r
+          gRT->ResetSystem(EfiResetCold, EFI_SUCCESS, StrSize(String), (VOID*)String);\r
         } else {\r
-          gRT->ResetSystem(EfiResetWarm, EFI_SUCCESS, 0, NULL);\r
+          gRT->ResetSystem(EfiResetCold, EFI_SUCCESS, 0, NULL);\r
         }\r
       }\r
     }\r