UefiCpuPkg S3Resume2Pei: Fix ASSERT in WriteToOsS3PerformanceData

This commit will resolve the issue brought by r17744.

AsciiStrCpyS (PerfData->Token, PERF_TOKEN_SIZE, Token);

The above using of AsciiStrCpyS will cause ASSERT if Token is longer than
PerfData->Token. Therefore, AsciiStrnCatS is used here to resolve the
issue.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17934 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Hao Wu 2015-07-13 01:24:24 +00:00 committed by hwu1225
parent 2673ffb356
commit c1fd37cd6b
1 changed files with 1 additions and 1 deletions

View File

@ -366,7 +366,7 @@ WriteToOsS3PerformanceData (
if ((AsciiStrnCmp (Token, "PEIM", PEI_PERFORMANCE_STRING_SIZE) == 0) && (Handle != NULL)) {
AsciiSPrint (PerfData->Token, PERF_TOKEN_LENGTH, "0x%11p", Handle);
} else {
AsciiStrCpyS (PerfData->Token, PERF_TOKEN_SIZE, Token);
AsciiStrnCpyS (PerfData->Token, PERF_TOKEN_SIZE, Token, PERF_TOKEN_LENGTH);
}
if (StartTicker == 1) {
StartTicker = StartValue;