summaryrefslogtreecommitdiff
path: root/MdeModulePkg
diff options
context:
space:
mode:
authorQiu Shumin <shumin.qiu@intel.com>2015-07-01 08:34:22 +0000
committershenshushi <shenshushi@Edk2>2015-07-01 08:34:22 +0000
commit568a5119a1b16cca8faa68fce9e15853eb5a322d (patch)
treecaa96ffcca5da7bcb3dbefe7eff418cad50a30b3 /MdeModulePkg
parent5e4b8bfe43530162ddcb498abb01e3326b6b7e97 (diff)
downloadedk2-platforms-568a5119a1b16cca8faa68fce9e15853eb5a322d.tar.xz
MdeModulePkg/Universal/Variable: Use safe string functions to refine code.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Qiu Shumin <shumin.qiu@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17789 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c6
-rw-r--r--MdeModulePkg/Universal/Variable/RuntimeDxe/VarCheck.c2
-rw-r--r--MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c6
3 files changed, 7 insertions, 7 deletions
diff --git a/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c b/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c
index e0768404f9..977332e1cf 100644
--- a/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c
+++ b/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c
@@ -3,7 +3,7 @@
Emulation Variable services operate on the runtime volatile memory.
The nonvolatile variable space doesn't exist.
-Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
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
@@ -322,7 +322,7 @@ UpdateVariableInfo (
CopyGuid (&gVariableInfo->VendorGuid, VendorGuid);
gVariableInfo->Name = AllocateZeroPool (StrSize (VariableName));
ASSERT (gVariableInfo->Name != NULL);
- StrnCpy (gVariableInfo->Name, VariableName, StrLen (VariableName));
+ StrCpyS (gVariableInfo->Name, StrSize(VariableName)/sizeof(CHAR16), VariableName);
gVariableInfo->Volatile = Volatile;
gBS->InstallConfigurationTable (&gEfiVariableGuid, gVariableInfo);
@@ -360,7 +360,7 @@ UpdateVariableInfo (
CopyGuid (&Entry->Next->VendorGuid, VendorGuid);
Entry->Next->Name = AllocateZeroPool (StrSize (VariableName));
ASSERT (Entry->Next->Name != NULL);
- StrnCpy (Entry->Next->Name, VariableName, StrLen (VariableName));
+ StrCpyS (Entry->Next->Name, StrSize(VariableName)/sizeof(CHAR16), VariableName);
Entry->Next->Volatile = Volatile;
}
diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VarCheck.c b/MdeModulePkg/Universal/Variable/RuntimeDxe/VarCheck.c
index ab0c1d6324..61de47d357 100644
--- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VarCheck.c
+++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VarCheck.c
@@ -1046,7 +1046,7 @@ InternalVarCheckVariablePropertySet (
goto Done;
}
VariableName = (CHAR16 *) ((UINTN) Entry + sizeof (*Entry));
- StrnCpy (VariableName, Name, StrLen (Name));
+ StrCpyS (VariableName, StrSize(Name)/sizeof(CHAR16), Name);
CopyGuid (&Entry->Guid, Guid);
CopyMem (&Entry->VariableProperty, VariableProperty, sizeof (*VariableProperty));
InsertTailList (&mVarCheckVariableList, &Entry->Link);
diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
index 70be71e7c7..e1dfeeaa03 100644
--- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
+++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
@@ -158,7 +158,7 @@ UpdateVariableInfo (
CopyGuid (&gVariableInfo->VendorGuid, VendorGuid);
gVariableInfo->Name = AllocateZeroPool (StrSize (VariableName));
ASSERT (gVariableInfo->Name != NULL);
- StrnCpy (gVariableInfo->Name, VariableName, StrLen (VariableName));
+ StrCpyS (gVariableInfo->Name, StrSize(VariableName)/sizeof(CHAR16), VariableName);
gVariableInfo->Volatile = Volatile;
}
@@ -194,7 +194,7 @@ UpdateVariableInfo (
CopyGuid (&Entry->Next->VendorGuid, VendorGuid);
Entry->Next->Name = AllocateZeroPool (StrSize (VariableName));
ASSERT (Entry->Next->Name != NULL);
- StrnCpy (Entry->Next->Name, VariableName, StrLen (VariableName));
+ StrCpyS (Entry->Next->Name, StrSize(VariableName)/sizeof(CHAR16), VariableName);
Entry->Next->Volatile = Volatile;
}
@@ -2853,7 +2853,7 @@ VariableLockRequestToLock (
}
Name = (CHAR16 *) ((UINTN) Entry + sizeof (*Entry));
- StrnCpy (Name, VariableName, StrLen (VariableName));
+ StrCpyS (Name, StrSize (VariableName)/sizeof(CHAR16), VariableName);
CopyGuid (&Entry->Guid, VendorGuid);
InsertTailList (&mLockedVariableList, &Entry->Link);