X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=SecurityPkg%2FLibrary%2FTpm2CommandLib%2FTpm2Sequences.c;fp=SecurityPkg%2FLibrary%2FTpm2CommandLib%2FTpm2Sequences.c;h=90877768d3afcc53e9291865ae2c924f2b1633bf;hb=dd577319e83d13a7ab46ffdccb6635281d2ca9e5;hp=305b6f20784a9132f38566afb112b87d88a8640f;hpb=ca2c8725c4894c55ffd7ce091e5f0c4ef9c794ed;p=mirror_edk2.git 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.
+Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.
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(