summaryrefslogtreecommitdiffstats
path: root/SecurityPkg/Library/Tpm2CommandLib/Tpm2Sequences.c
diff options
context:
space:
mode:
Diffstat (limited to 'SecurityPkg/Library/Tpm2CommandLib/Tpm2Sequences.c')
-rw-r--r--SecurityPkg/Library/Tpm2CommandLib/Tpm2Sequences.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/SecurityPkg/Library/Tpm2CommandLib/Tpm2Sequences.c b/SecurityPkg/Library/Tpm2CommandLib/Tpm2Sequences.c
index 305b6f2078..90877768d3 100644
--- a/SecurityPkg/Library/Tpm2CommandLib/Tpm2Sequences.c
+++ b/SecurityPkg/Library/Tpm2CommandLib/Tpm2Sequences.c
@@ -1,7 +1,7 @@
/** @file
Implement TPM2 Sequences related command.
-Copyright (c) 2013, Intel Corporation. All rights reserved. <BR>
+Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved. <BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -375,6 +375,11 @@ Tpm2EventSequenceComplete (
// count
Results->count = SwapBytes32(ReadUnaligned32 ((UINT32 *)BufferPtr));
+ if (Results->count > HASH_COUNT) {
+ DEBUG ((DEBUG_ERROR, "Tpm2EventSequenceComplete - Results->count error %x\n", Results->count));
+ return EFI_DEVICE_ERROR;
+ }
+
BufferPtr += sizeof(UINT32);
for (Index = 0; Index < Results->count; Index++) {
@@ -496,6 +501,11 @@ Tpm2SequenceComplete (
// digestSize
Result->size = SwapBytes16(ReadUnaligned16 ((UINT16 *)BufferPtr));
+ if (Result->size > sizeof(TPMU_HA)){
+ DEBUG ((DEBUG_ERROR, "Tpm2SequenceComplete - Result->size error %x\n", Result->size));
+ return EFI_DEVICE_ERROR;
+ }
+
BufferPtr += sizeof(UINT16);
CopyMem(