]> git.proxmox.com Git - mirror_edk2.git/commitdiff
1. Update AuthVarialbe driver to avoid integer overflow when using EFI_VARIABLE_AUTHE...
authorsfu5 <sfu5@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 26 Mar 2012 01:43:45 +0000 (01:43 +0000)
committersfu5 <sfu5@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 26 Mar 2012 01:43:45 +0000 (01:43 +0000)
Signed-off-by: sfu5
Reviewed-by: tye
Reviewed-by: gdong1
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13120 6f19259b-4bc3-4df7-8a09-765794883524

SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.c

index e3fc48b497cfc64b470808d96fb78f168c3d477f..c84a2f62d3d70c6aa43f7df96c41fac631b59004 100644 (file)
@@ -2,7 +2,7 @@
   The common variable operation routines shared by DXE_RINTIME variable\r
   module and DXE_SMM variable module.\r
 \r
   The common variable operation routines shared by DXE_RINTIME variable\r
   module and DXE_SMM variable module.\r
 \r
-Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -2163,8 +2163,8 @@ VariableServiceSetVariable (
     // Sanity check for EFI_VARIABLE_AUTHENTICATION_2 descriptor.\r
     //\r
     if (DataSize < OFFSET_OF_AUTHINFO2_CERT_DATA ||\r
     // Sanity check for EFI_VARIABLE_AUTHENTICATION_2 descriptor.\r
     //\r
     if (DataSize < OFFSET_OF_AUTHINFO2_CERT_DATA ||\r
-       DataSize < AUTHINFO2_SIZE (Data) ||\r
-       ((EFI_VARIABLE_AUTHENTICATION_2 *) Data)->AuthInfo.Hdr.dwLength < OFFSET_OF (WIN_CERTIFICATE_UEFI_GUID, CertData)) {\r
+      ((EFI_VARIABLE_AUTHENTICATION_2 *) Data)->AuthInfo.Hdr.dwLength > DataSize - (OFFSET_OF (EFI_VARIABLE_AUTHENTICATION_2, AuthInfo)) ||\r
+      ((EFI_VARIABLE_AUTHENTICATION_2 *) Data)->AuthInfo.Hdr.dwLength < OFFSET_OF (WIN_CERTIFICATE_UEFI_GUID, CertData)) {\r
       return EFI_SECURITY_VIOLATION;\r
     }\r
     PayloadSize = DataSize - AUTHINFO2_SIZE (Data);\r
       return EFI_SECURITY_VIOLATION;\r
     }\r
     PayloadSize = DataSize - AUTHINFO2_SIZE (Data);\r