]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Check the input file pointer before use it.
authorEric Dong <eric.dong@intel.com>
Fri, 28 Mar 2014 05:51:51 +0000 (05:51 +0000)
committerydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 28 Mar 2014 05:51:51 +0000 (05:51 +0000)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Guo, Dong <guo.dong@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15412 6f19259b-4bc3-4df7-8a09-765794883524

SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.c
SecurityPkg/Library/DxeTpmMeasureBootLib/DxeTpmMeasureBootLib.c

index 3c81b5af513d6b55e1cb7399daa421c7e4998480..8482031e437ead45300c5bd2939906c3374a1d7d 100644 (file)
@@ -15,7 +15,7 @@
   TrEEMeasureGptTable() function will receive untrusted GPT partition table, and parse\r
   partition data carefully.\r
 \r
   TrEEMeasureGptTable() function will receive untrusted GPT partition table, and parse\r
   partition data carefully.\r
 \r
-Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2013 - 2014, 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
@@ -351,7 +351,9 @@ TrEEMeasurePeImage (
   ImageLoad->ImageLengthInMemory   = ImageSize;\r
   ImageLoad->ImageLinkTimeAddress  = LinkTimeBase;\r
   ImageLoad->LengthOfDevicePath    = FilePathSize;\r
   ImageLoad->ImageLengthInMemory   = ImageSize;\r
   ImageLoad->ImageLinkTimeAddress  = LinkTimeBase;\r
   ImageLoad->LengthOfDevicePath    = FilePathSize;\r
-  CopyMem (ImageLoad->DevicePath, FilePath, FilePathSize);\r
+  if ((FilePath != NULL) && (FilePathSize != 0)) {\r
+    CopyMem (ImageLoad->DevicePath, FilePath, FilePathSize);\r
+  }\r
 \r
   //\r
   // Log the PE data\r
 \r
   //\r
   // Log the PE data\r
index d11ec13373c2b1b0454bf0cdbdef932c1109b384..5bfa282bc5e2d2dc0c3157351196385fc6f5f21a 100644 (file)
@@ -15,7 +15,7 @@
   TcgMeasureGptTable() function will receive untrusted GPT partition table, and parse\r
   partition data carefully.\r
 \r
   TcgMeasureGptTable() function will receive untrusted GPT partition table, and parse\r
   partition data carefully.\r
 \r
-Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2009 - 2014, 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
@@ -371,7 +371,9 @@ TcgMeasurePeImage (
   ImageLoad->ImageLengthInMemory   = ImageSize;\r
   ImageLoad->ImageLinkTimeAddress  = LinkTimeBase;\r
   ImageLoad->LengthOfDevicePath    = FilePathSize;\r
   ImageLoad->ImageLengthInMemory   = ImageSize;\r
   ImageLoad->ImageLinkTimeAddress  = LinkTimeBase;\r
   ImageLoad->LengthOfDevicePath    = FilePathSize;\r
-  CopyMem (ImageLoad->DevicePath, FilePath, FilePathSize);\r
+  if ((FilePath != NULL) && (FilePathSize != 0)) {\r
+    CopyMem (ImageLoad->DevicePath, FilePath, FilePathSize);\r
+  }\r
 \r
   //\r
   // Check PE/COFF image\r
 \r
   //\r
   // Check PE/COFF image\r