summaryrefslogtreecommitdiffstats
path: root/MdePkg
diff options
context:
space:
mode:
authorHao Wu <hao.a.wu@intel.com>2015-08-05 02:55:40 +0000
committerhwu1225 <hwu1225@Edk2>2015-08-05 02:55:40 +0000
commita3f28ac92c6aa90e91e44d3993378dc38c66841e (patch)
tree902c52dd9a36e818117694807ae94e2552de6c5c /MdePkg
parentdba275689353e49617f60ebe85618f17e1774bfb (diff)
downloadedk2-a3f28ac92c6aa90e91e44d3993378dc38c66841e.tar.gz
edk2-a3f28ac92c6aa90e91e44d3993378dc38c66841e.tar.bz2
edk2-a3f28ac92c6aa90e91e44d3993378dc38c66841e.zip
MdePkg UefiLib: Fix wrong DestMax passed to StrCpyS()
The second parameter 'DestMax' of StrCpyS() should be the number of unicode characters, not the size in bytes. Also, code is modified to keep align with the one in IntelFrameworkPkg\Library\FrameworkUefiLib\UefiLibPrint.c. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18160 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg')
-rw-r--r--MdePkg/Library/UefiLib/UefiLibPrint.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/MdePkg/Library/UefiLib/UefiLibPrint.c b/MdePkg/Library/UefiLib/UefiLibPrint.c
index 91ce49235b..9f52e7d0ce 100644
--- a/MdePkg/Library/UefiLib/UefiLibPrint.c
+++ b/MdePkg/Library/UefiLib/UefiLibPrint.c
@@ -754,14 +754,16 @@ CatVSPrint (
SizeRequired = sizeof(CHAR16) + (CharactersRequired * sizeof(CHAR16));
}
- BufferToReturn = AllocateZeroPool(SizeRequired);
+ BufferToReturn = AllocatePool(SizeRequired);
if (BufferToReturn == NULL) {
return NULL;
+ } else {
+ BufferToReturn[0] = L'\0';
}
-
+
if (String != NULL) {
- StrCpyS(BufferToReturn, SizeRequired, String);
+ StrCpyS(BufferToReturn, SizeRequired / sizeof(CHAR16), String);
}
UnicodeVSPrint(BufferToReturn + StrLen(BufferToReturn), (CharactersRequired+1) * sizeof(CHAR16), FormatString, Marker);