This commit will resolve the issue brought by r17738.

String = AllocateCopyPool (BufferLen, L"MAC:");

The above using of AllocateCopyPool() will read contents out of the scope
of the constant string. Potential risk for the constant string allocated
at the boundary of memory region.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a...@intel.com>
Reviewed-by: Qiu Shumin <shumin....@intel.com>
Reviewed-by: Jeff Fan <jeff....@intel.com>
---
 IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git 
a/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.c 
b/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.c
index 5da0d47..af2b18a 100644
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.c
+++ b/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.c
@@ -374,12 +374,13 @@ GetMacAddressString(
   // The size is the Number size + ":" size + Vlan size(\XXXX) + End
   //
   BufferLen = (4 + 2 * HwAddressSize + (HwAddressSize - 1) + 5 + 1) * sizeof 
(CHAR16);
-  String = AllocateCopyPool (BufferLen, L"MAC:");
+  String = AllocateZeroPool (BufferLen);
   if (String == NULL) {
     return FALSE;
   }
 
   *PBuffer = String;
+  StrCpyS (String, BufferLen / sizeof (CHAR16), L"MAC:");
   String += 4;
   
   //
-- 
1.9.5.msysgit.0


------------------------------------------------------------------------------
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-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to