summaryrefslogtreecommitdiffstats
path: root/MdePkg/Library/UefiLib
diff options
context:
space:
mode:
authorHeyi Guo <heyi.guo@linaro.org>2015-07-06 06:34:47 +0000
committershenshushi <shenshushi@Edk2>2015-07-06 06:34:47 +0000
commit228593f9068f745193afefa6a1f0184b5d210880 (patch)
treec3a6060ff836ee9472fff408536c007d2111dbcd /MdePkg/Library/UefiLib
parent0b5203bd84130947f8971db059cad7380f8debed (diff)
downloadedk2-228593f9068f745193afefa6a1f0184b5d210880.tar.gz
edk2-228593f9068f745193afefa6a1f0184b5d210880.tar.bz2
edk2-228593f9068f745193afefa6a1f0184b5d210880.zip
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
Diffstat (limited to 'MdePkg/Library/UefiLib')
-rw-r--r--MdePkg/Library/UefiLib/UefiLibPrint.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/MdePkg/Library/UefiLib/UefiLibPrint.c b/MdePkg/Library/UefiLib/UefiLibPrint.c
index cc41eb0343..91ce49235b 100644
--- a/MdePkg/Library/UefiLib/UefiLibPrint.c
+++ b/MdePkg/Library/UefiLib/UefiLibPrint.c
@@ -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);