X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=ShellPkg%2FLibrary%2FUefiShellDebug1CommandsLib%2FSetVar.c;h=c59032a81162ea4c523da28ab1fe4763b2760eaa;hp=d98a3469a31ddf2d951c403d99ef8c110f1baeb6;hb=7f6511ee577cd292312f1dfb02908794c8bc5aba;hpb=241f914975d50e34f6da57d1e5ac60eedb5d52de diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SetVar.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/SetVar.c index d98a3469a3..c59032a811 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SetVar.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SetVar.c @@ -2,7 +2,7 @@ Main file for SetVar shell Debug1 function. (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.
+ Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
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 @@ -65,6 +65,7 @@ ShellCommandRunSetVar ( ) { EFI_STATUS Status; + RETURN_STATUS RStatus; LIST_ENTRY *Package; CHAR16 *ProblemParam; SHELL_STATUS ShellStatus; @@ -120,8 +121,8 @@ ShellCommandRunSetVar ( CopyGuid(&Guid, &gEfiGlobalVariableGuid); } else { StringGuid = ShellCommandLineGetValue(Package, L"-guid"); - Status = ConvertStringToGuid(StringGuid, &Guid); - if (EFI_ERROR(Status)) { + RStatus = StrToGuid (StringGuid, &Guid); + if (RETURN_ERROR (RStatus) || (StringGuid[GUID_STRING_LENGTH] != L'\0')) { ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"setvar", StringGuid); ShellStatus = SHELL_INVALID_PARAMETER; } @@ -207,10 +208,7 @@ ShellCommandRunSetVar ( if (Buffer == NULL) { Status = EFI_OUT_OF_RESOURCES; } else { - for (LoopVar = 0 ; LoopVar < (StrLen(Data) / 2) ; LoopVar++) { - ((UINT8*)Buffer)[LoopVar] = (UINT8)(HexCharToUintn(Data[LoopVar*2]) * 16); - ((UINT8*)Buffer)[LoopVar] = (UINT8)(((UINT8*)Buffer)[LoopVar] + HexCharToUintn(Data[LoopVar*2+1])); - } + StrHexToBytes (Data, StrLen (Data), Buffer, StrLen (Data) / 2); Status = gRT->SetVariable((CHAR16*)VariableName, &Guid, Attributes, StrLen(Data) / 2, Buffer); } if (EFI_ERROR(Status)) {