summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQiu Shumin <shumin.qiu@intel.com>2015-07-08 01:08:09 +0000
committershenshushi <shenshushi@Edk2>2015-07-08 01:08:09 +0000
commit8feb7452acedf5bbe0f6c3accac8562b7cc29b3d (patch)
tree8f13834f1cfebcc75adf88b4cd592fa1e11975e1
parent5ddccf34c4f57e6e7fca767c1628a0d98ce8bdaf (diff)
downloadedk2-platforms-8feb7452acedf5bbe0f6c3accac8562b7cc29b3d.tar.xz
MdeModulePkg: Refine code to use Strn**S safe functions instead of Str**S ones in some cases.
Safe string functions may ASSERT when the source length is larger than the MaxDest. This patch use Strn**S to indicate the copy length. 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@17867 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--MdeModulePkg/Application/MemoryProfileInfo/MemoryProfileInfo.c2
-rw-r--r--MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c4
-rw-r--r--MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c4
3 files changed, 5 insertions, 5 deletions
diff --git a/MdeModulePkg/Application/MemoryProfileInfo/MemoryProfileInfo.c b/MdeModulePkg/Application/MemoryProfileInfo/MemoryProfileInfo.c
index b425af17c2..f69a3e7748 100644
--- a/MdeModulePkg/Application/MemoryProfileInfo/MemoryProfileInfo.c
+++ b/MdeModulePkg/Application/MemoryProfileInfo/MemoryProfileInfo.c
@@ -201,7 +201,7 @@ GetDriverNameString (
//
// Method 2: Get the name string from FFS UI section
//
- StrCpyS (mNameString, PROFILE_NAME_STRING_LENGTH + 1, NameString);
+ StrnCpyS (mNameString, PROFILE_NAME_STRING_LENGTH + 1, NameString, PROFILE_NAME_STRING_LENGTH);
mNameString[PROFILE_NAME_STRING_LENGTH] = 0;
FreePool (NameString);
return;
diff --git a/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c b/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
index 4eb47d1386..0b5a717caa 100644
--- a/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
+++ b/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
@@ -190,10 +190,10 @@ StartPerformanceMeasurementEx (
LogEntryArray[Index].Handle = (EFI_PHYSICAL_ADDRESS) (UINTN) Handle;
if (Token != NULL) {
- AsciiStrCpyS (LogEntryArray[Index].Token, PEI_PERFORMANCE_STRING_SIZE, Token);
+ AsciiStrnCpyS (LogEntryArray[Index].Token, PEI_PERFORMANCE_STRING_SIZE, Token, PEI_PERFORMANCE_STRING_LENGTH);
}
if (Module != NULL) {
- AsciiStrCpyS (LogEntryArray[Index].Module, PEI_PERFORMANCE_STRING_SIZE, Module);
+ AsciiStrnCpyS (LogEntryArray[Index].Module, PEI_PERFORMANCE_STRING_SIZE, Module, PEI_PERFORMANCE_STRING_LENGTH);
}
LogEntryArray[Index].EndTimeStamp = 0;
diff --git a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c
index 485f713864..f28b657c94 100644
--- a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c
+++ b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c
@@ -203,10 +203,10 @@ StartGaugeEx (
GaugeEntryExArray[Index].Handle = (EFI_PHYSICAL_ADDRESS) (UINTN) Handle;
if (Token != NULL) {
- AsciiStrCpyS (GaugeEntryExArray[Index].Token, SMM_PERFORMANCE_STRING_SIZE, Token);
+ AsciiStrnCpyS (GaugeEntryExArray[Index].Token, SMM_PERFORMANCE_STRING_SIZE, Token, SMM_PERFORMANCE_STRING_LENGTH);
}
if (Module != NULL) {
- AsciiStrCpyS (GaugeEntryExArray[Index].Module, SMM_PERFORMANCE_STRING_SIZE, Module);
+ AsciiStrnCpyS (GaugeEntryExArray[Index].Module, SMM_PERFORMANCE_STRING_SIZE, Module, SMM_PERFORMANCE_STRING_LENGTH);
}
GaugeEntryExArray[Index].EndTimeStamp = 0;