]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c
MdeModulePkg/Universal/Variable: Use safe string functions to refine code.
[mirror_edk2.git] / MdeModulePkg / Universal / Variable / EmuRuntimeDxe / EmuVariable.c
index e0768404f9fc61c3fdd02b3a0a38a38102f6be38..977332e1cf4999a58ded7276f2bcc2d9c92e13ea 100644 (file)
@@ -3,7 +3,7 @@
   Emulation Variable services operate on the runtime volatile memory.\r
   The nonvolatile variable space doesn't exist.\r
 \r
-Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2015, 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
@@ -322,7 +322,7 @@ UpdateVariableInfo (
       CopyGuid (&gVariableInfo->VendorGuid, VendorGuid);\r
       gVariableInfo->Name = AllocateZeroPool (StrSize (VariableName));\r
       ASSERT (gVariableInfo->Name != NULL);\r
-      StrnCpy (gVariableInfo->Name, VariableName, StrLen (VariableName));\r
+      StrCpyS (gVariableInfo->Name, StrSize(VariableName)/sizeof(CHAR16), VariableName);\r
       gVariableInfo->Volatile = Volatile;\r
 \r
       gBS->InstallConfigurationTable (&gEfiVariableGuid, gVariableInfo);\r
@@ -360,7 +360,7 @@ UpdateVariableInfo (
         CopyGuid (&Entry->Next->VendorGuid, VendorGuid);\r
         Entry->Next->Name = AllocateZeroPool (StrSize (VariableName));\r
         ASSERT (Entry->Next->Name != NULL);\r
-        StrnCpy (Entry->Next->Name, VariableName, StrLen (VariableName));\r
+        StrCpyS (Entry->Next->Name, StrSize(VariableName)/sizeof(CHAR16), VariableName);\r
         Entry->Next->Volatile = Volatile;\r
       }\r
 \r