Revision: 17929
          http://sourceforge.net/p/edk2/code/17929
Author:   hwu1225
Date:     2015-07-13 01:22:21 +0000 (Mon, 13 Jul 2015)
Log Message:
-----------
IntelFrameworkModulePkg GenericBdsLib: Potential read over memory boudary

This commit will resolve the issue brought by r17733.

StringBuffer1 = AllocateCopyPool (
                  MAX_STRING_LEN * sizeof (CHAR16),
                  L"Configuration changed. Reset to apply it Now."
                  );

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 <[email protected]>
Reviewed-by: Qiu Shumin <[email protected]>
Reviewed-by: Jeff Fan <[email protected]>

Revision Links:
--------------
    http://sourceforge.net/p/edk2/code/17733

Modified Paths:
--------------
    trunk/edk2/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsMisc.c

Modified: trunk/edk2/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsMisc.c
===================================================================
--- trunk/edk2/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsMisc.c  
2015-07-12 18:58:24 UTC (rev 17928)
+++ trunk/edk2/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsMisc.c  
2015-07-13 01:22:21 UTC (rev 17929)
@@ -1127,16 +1127,20 @@
   if (IsResetReminderFeatureEnable ()) {
     if (IsResetRequired ()) {
 
-      StringBuffer1 = AllocateCopyPool (
-                        MAX_STRING_LEN * sizeof (CHAR16),
-                        L"Configuration changed. Reset to apply it Now."
-                        );
+      StringBuffer1 = AllocateZeroPool (MAX_STRING_LEN * sizeof (CHAR16));
       ASSERT (StringBuffer1 != NULL);
-      StringBuffer2 = AllocateCopyPool (
-                        MAX_STRING_LEN * sizeof (CHAR16),
-                        L"Press ENTER to reset"
-                        );
+      StringBuffer2 = AllocateZeroPool (MAX_STRING_LEN * sizeof (CHAR16));
       ASSERT (StringBuffer2 != NULL);
+      StrCpyS (
+        StringBuffer1,
+        MAX_STRING_LEN,
+        L"Configuration changed. Reset to apply it Now."
+        );
+      StrCpyS (
+        StringBuffer2,
+        MAX_STRING_LEN,
+        L"Press ENTER to reset"
+        );
       //
       // Popup a menu to notice user
       //


------------------------------------------------------------------------------
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

Reply via email to