Revision: 18160
http://sourceforge.net/p/edk2/code/18160
Author: hwu1225
Date: 2015-08-05 02:55:40 +0000 (Wed, 05 Aug 2015)
Log Message:
-----------
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 <[email protected]>
Reviewed-by: Liming Gao <[email protected]>
Modified Paths:
--------------
trunk/edk2/MdePkg/Library/UefiLib/UefiLibPrint.c
Modified: trunk/edk2/MdePkg/Library/UefiLib/UefiLibPrint.c
===================================================================
--- trunk/edk2/MdePkg/Library/UefiLib/UefiLibPrint.c 2015-08-05 02:55:05 UTC
(rev 18159)
+++ trunk/edk2/MdePkg/Library/UefiLib/UefiLibPrint.c 2015-08-05 02:55:40 UTC
(rev 18160)
@@ -754,14 +754,16 @@
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);
------------------------------------------------------------------------------
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits