mirror of https://github.com/acidanthera/audk.git
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:
parent
0b5203bd84
commit
228593f906
|
@ -754,12 +754,16 @@ 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);
|
||||
|
||||
ASSERT(StrSize(BufferToReturn)==SizeRequired);
|
||||
|
|
Loading…
Reference in New Issue