Revision: 17906
http://sourceforge.net/p/edk2/code/17906
Author: hwu1225
Date: 2015-07-10 01:08:05 +0000 (Fri, 10 Jul 2015)
Log Message:
-----------
IntelFrameworkPkg FrameworkUefiLib: Fix ASSERT in CatVSPrint
This commit will resolve issue brought by r17740.
BufferToReturn = AllocateCopyPool(SizeRequired, String);
The above using of AllocateCopyPool() will cause ASSERT if 'String' is
NULL. Therefore, proper check for 'String' is needed.
The above using of AllocateCopyPool() will read contents out of the scope
of 'String'. Potential risk for 'String' allocated at the boundary of
memory region.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <[email protected]>
Reviewed-by: Jordan Justen <[email protected]>
Revision Links:
--------------
http://sourceforge.net/p/edk2/code/17740
Modified Paths:
--------------
trunk/edk2/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLibPrint.c
Modified: trunk/edk2/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLibPrint.c
===================================================================
--- trunk/edk2/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLibPrint.c
2015-07-09 16:29:44 UTC (rev 17905)
+++ trunk/edk2/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLibPrint.c
2015-07-10 01:08:05 UTC (rev 17906)
@@ -754,12 +754,18 @@
SizeRequired = sizeof(CHAR16) + (CharactersRequired * sizeof(CHAR16));
}
- BufferToReturn = AllocateCopyPool(SizeRequired, String);
+ BufferToReturn = AllocatePool(SizeRequired);
if (BufferToReturn == NULL) {
return NULL;
+ } else {
+ BufferToReturn[0] = L'\0';
}
+ if (String != NULL) {
+ StrCpyS(BufferToReturn, SizeRequired, String);
+ }
+
UnicodeVSPrint(BufferToReturn + StrLen(BufferToReturn),
(CharactersRequired+1) * sizeof(CHAR16), FormatString, Marker);
ASSERT(StrSize(BufferToReturn)==SizeRequired);
------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits