Revision: 17867
http://sourceforge.net/p/edk2/code/17867
Author: shenshushi
Date: 2015-07-08 01:08:09 +0000 (Wed, 08 Jul 2015)
Log Message:
-----------
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 <[email protected]>
Reviewed-by: Star Zeng <[email protected]>
Modified Paths:
--------------
trunk/edk2/MdeModulePkg/Application/MemoryProfileInfo/MemoryProfileInfo.c
trunk/edk2/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
trunk/edk2/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c
Modified:
trunk/edk2/MdeModulePkg/Application/MemoryProfileInfo/MemoryProfileInfo.c
===================================================================
--- trunk/edk2/MdeModulePkg/Application/MemoryProfileInfo/MemoryProfileInfo.c
2015-07-08 01:06:25 UTC (rev 17866)
+++ trunk/edk2/MdeModulePkg/Application/MemoryProfileInfo/MemoryProfileInfo.c
2015-07-08 01:08:09 UTC (rev 17867)
@@ -201,7 +201,7 @@
//
// 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;
Modified: trunk/edk2/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
===================================================================
--- trunk/edk2/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
2015-07-08 01:06:25 UTC (rev 17866)
+++ trunk/edk2/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
2015-07-08 01:08:09 UTC (rev 17867)
@@ -190,10 +190,10 @@
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;
Modified:
trunk/edk2/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c
===================================================================
---
trunk/edk2/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c
2015-07-08 01:06:25 UTC (rev 17866)
+++
trunk/edk2/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c
2015-07-08 01:08:09 UTC (rev 17867)
@@ -203,10 +203,10 @@
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;
------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits