MdePkg: Fix bug in CatVSPrint introduced by r17742.

Just use a more conservative way to replace unsafe StrCpy.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Heyi Guo <heyi.guo@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Qiu Shumin <shumin.qiu@intel.com> 

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17823 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Heyi Guo 2015-07-06 06:34:47 +00:00 committed by shenshushi
parent 0b5203bd84
commit 228593f906
1 changed files with 5 additions and 1 deletions

View File

@ -754,11 +754,15 @@ CatVSPrint (
SizeRequired = sizeof(CHAR16) + (CharactersRequired * sizeof(CHAR16));
}
BufferToReturn = AllocateCopyPool(SizeRequired, String);
BufferToReturn = AllocateZeroPool(SizeRequired);
if (BufferToReturn == NULL) {
return NULL;
}
if (String != NULL) {
StrCpyS(BufferToReturn, SizeRequired, String);
}
UnicodeVSPrint(BufferToReturn + StrLen(BufferToReturn), (CharactersRequired+1) * sizeof(CHAR16), FormatString, Marker);