X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=EmbeddedPkg%2FEbl%2FVariable.c;h=92464a6b7133396ff98f4b39451c341ae154c279;hp=5c00122cdb16e6c5b1611eeea69073c1827bee46;hb=d780544d3d1c67e2663e146e97c29bb2dc308172;hpb=a6caee65ac3bba2ac649f20bf1c63f0a87050f17 diff --git a/EmbeddedPkg/Ebl/Variable.c b/EmbeddedPkg/Ebl/Variable.c index 5c00122cdb..92464a6b71 100644 --- a/EmbeddedPkg/Ebl/Variable.c +++ b/EmbeddedPkg/Ebl/Variable.c @@ -1,14 +1,15 @@ /** @file * * Copyright (c) 2011, ARM Limited. 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 -* http://opensource.org/licenses/bsd-license.php +* (C) Copyright 2015 Hewlett Packard Enterprise Development LP
* -* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* 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 +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. * **/ @@ -17,6 +18,7 @@ #include EFI_STATUS +EFIAPI EblGetCmd ( IN UINTN Argc, IN CHAR8 **Argv @@ -27,6 +29,7 @@ EblGetCmd ( VOID* Value; CHAR8* AsciiVariableName = NULL; CHAR16* VariableName; + UINTN VariableNameLen; UINT32 Index; if (Argc == 1) { @@ -46,8 +49,9 @@ EblGetCmd ( AsciiPrint("Variable name is missing.\n"); return Status; } else { - VariableName = AllocatePool((AsciiStrLen (AsciiVariableName) + 1) * sizeof (CHAR16)); - AsciiStrToUnicodeStr (AsciiVariableName,VariableName); + VariableNameLen = AsciiStrLen (AsciiVariableName) + 1; + VariableName = AllocatePool (VariableNameLen * sizeof (CHAR16)); + AsciiStrToUnicodeStrS (AsciiVariableName, VariableName, VariableNameLen); } // Try to get the variable size. @@ -79,6 +83,7 @@ EblGetCmd ( } EFI_STATUS +EFIAPI EblSetCmd ( IN UINTN Argc, IN CHAR8 **Argv @@ -90,6 +95,7 @@ EblSetCmd ( CHAR8* AsciiValue; UINT32 AsciiValueLength; CHAR16* VariableName; + UINTN VariableNameLen; UINT32 Index; UINT32 EscapedQuotes = 0; BOOLEAN Volatile = FALSE; @@ -113,7 +119,7 @@ EblSetCmd ( AsciiPrint("Variable name is missing.\n"); return Status; } - + // Check if it is a valid variable setting AsciiValue = AsciiStrStr (AsciiVariableSetting,"="); if (AsciiValue == NULL) { @@ -122,8 +128,9 @@ EblSetCmd ( // // Convert VariableName into Unicode - VariableName = AllocatePool((AsciiStrLen (AsciiVariableSetting) + 1) * sizeof (CHAR16)); - AsciiStrToUnicodeStr (AsciiVariableSetting,VariableName); + VariableNameLen = AsciiStrLen (AsciiVariableSetting) + 1; + VariableName = AllocatePool (VariableNameLen * sizeof (CHAR16)); + AsciiStrToUnicodeStrS (AsciiVariableSetting, VariableName, VariableNameLen); Status = gRT->SetVariable ( VariableName, @@ -167,8 +174,9 @@ EblSetCmd ( } // Convert VariableName into Unicode - VariableName = AllocatePool((AsciiStrLen (AsciiVariableName) + 1) * sizeof (CHAR16)); - AsciiStrToUnicodeStr (AsciiVariableName,VariableName); + VariableNameLen = AsciiStrLen (AsciiVariableName) + 1; + VariableName = AllocatePool (VariableNameLen * sizeof (CHAR16)); + AsciiStrToUnicodeStrS (AsciiVariableName, VariableName, VariableNameLen); Status = gRT->SetVariable ( VariableName,