From 8feb7452acedf5bbe0f6c3accac8562b7cc29b3d Mon Sep 17 00:00:00 2001 From: Qiu Shumin Date: Wed, 8 Jul 2015 01:08:09 +0000 Subject: 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 Reviewed-by: Star Zeng git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17867 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'MdeModulePkg/Library/SmmCorePerformanceLib') 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; -- cgit v1.2.3