Revision: 18801
          http://sourceforge.net/p/edk2/code/18801
Author:   vanjeff
Date:     2015-11-16 07:17:53 +0000 (Mon, 16 Nov 2015)
Log Message:
-----------
SecurityPkg : Fix Rsa2048Sha256GuidedSectionExtractLib issue

This issue causes section extraction overrun and possible hang due to bad 
output size calculation.

(Sync patch r18625 from main trunk.)

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: "Cohen, Eugene" <[email protected]>
Reviewed-by: "Zhang, Chao B" <[email protected]>

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

Modified Paths:
--------------
    
branches/UDK2015/SecurityPkg/Library/DxeRsa2048Sha256GuidedSectionExtractLib/DxeRsa2048Sha256GuidedSectionExtractLib.c
    
branches/UDK2015/SecurityPkg/Library/PeiRsa2048Sha256GuidedSectionExtractLib/PeiRsa2048Sha256GuidedSectionExtractLib.c

Modified: 
branches/UDK2015/SecurityPkg/Library/DxeRsa2048Sha256GuidedSectionExtractLib/DxeRsa2048Sha256GuidedSectionExtractLib.c
===================================================================
--- 
branches/UDK2015/SecurityPkg/Library/DxeRsa2048Sha256GuidedSectionExtractLib/DxeRsa2048Sha256GuidedSectionExtractLib.c
      2015-11-16 07:17:05 UTC (rev 18800)
+++ 
branches/UDK2015/SecurityPkg/Library/DxeRsa2048Sha256GuidedSectionExtractLib/DxeRsa2048Sha256GuidedSectionExtractLib.c
      2015-11-16 07:17:53 UTC (rev 18801)
@@ -86,7 +86,7 @@
     //
     *SectionAttribute  = ((EFI_GUID_DEFINED_SECTION2 *) 
InputSection)->Attributes;
     *ScratchBufferSize = 0;
-    *OutputBufferSize  = SECTION2_SIZE (InputSection) - 
((EFI_GUID_DEFINED_SECTION2 *) InputSection)->DataOffset;
+    *OutputBufferSize  = SECTION2_SIZE (InputSection) - 
sizeof(RSA_2048_SHA_256_SECTION2_HEADER);
   } else {
     //
     // Check whether the input guid section is recognized.
@@ -101,7 +101,7 @@
     //
     *SectionAttribute  = ((EFI_GUID_DEFINED_SECTION *) 
InputSection)->Attributes;
     *ScratchBufferSize = 0;
-    *OutputBufferSize  = SECTION_SIZE (InputSection) - 
((EFI_GUID_DEFINED_SECTION *) InputSection)->DataOffset;
+    *OutputBufferSize  = SECTION_SIZE (InputSection) - 
sizeof(RSA_2048_SHA_256_SECTION_HEADER);
   }
 
   return EFI_SUCCESS;

Modified: 
branches/UDK2015/SecurityPkg/Library/PeiRsa2048Sha256GuidedSectionExtractLib/PeiRsa2048Sha256GuidedSectionExtractLib.c
===================================================================
--- 
branches/UDK2015/SecurityPkg/Library/PeiRsa2048Sha256GuidedSectionExtractLib/PeiRsa2048Sha256GuidedSectionExtractLib.c
      2015-11-16 07:17:05 UTC (rev 18800)
+++ 
branches/UDK2015/SecurityPkg/Library/PeiRsa2048Sha256GuidedSectionExtractLib/PeiRsa2048Sha256GuidedSectionExtractLib.c
      2015-11-16 07:17:53 UTC (rev 18801)
@@ -84,7 +84,7 @@
     //
     *SectionAttribute  = ((EFI_GUID_DEFINED_SECTION2 *) 
InputSection)->Attributes;
     *ScratchBufferSize = 0;
-    *OutputBufferSize  = SECTION2_SIZE (InputSection) - 
((EFI_GUID_DEFINED_SECTION2 *) InputSection)->DataOffset;
+    *OutputBufferSize  = SECTION2_SIZE (InputSection) - 
sizeof(RSA_2048_SHA_256_SECTION2_HEADER);
   } else {
     //
     // Check whether the input guid section is recognized.
@@ -99,7 +99,7 @@
     //
     *SectionAttribute  = ((EFI_GUID_DEFINED_SECTION *) 
InputSection)->Attributes;
     *ScratchBufferSize = 0;
-    *OutputBufferSize  = SECTION_SIZE (InputSection) - 
((EFI_GUID_DEFINED_SECTION *) InputSection)->DataOffset;
+    *OutputBufferSize  = SECTION_SIZE (InputSection) - 
sizeof(RSA_2048_SHA_256_SECTION_HEADER);
   }
 
   return EFI_SUCCESS;


------------------------------------------------------------------------------
Presto, an open source distributed SQL query engine for big data, initially
developed by Facebook, enables you to easily query your data on Hadoop in a 
more interactive manner. Teradata is also now providing full enterprise
support for Presto. Download a free open source copy now.
http://pubads.g.doubleclick.net/gampad/clk?id=250295911&iu=/4140
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to