From: Ilias Apalodimas Date: Wed, 14 Apr 2021 08:43:23 +0300 Subject: [PATCH] efi_loader: fix possible buffer overflow In-Reply-To: <20210414025549.7403-1-masahisa.kojima@linaro.org> References: <20210414025549.7403-1-masahisa.kojima@linaro.org> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Wed, Apr 14, 2021 at 11:55:49AM +0900, Masahisa Kojima wrote: > Variable "final" will have SHA512 digest, but currently > the array size is not sufficient. Let's fix it. > > Signed-off-by: Masahisa Kojima > --- > lib/efi_loader/efi_tcg2.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/lib/efi_loader/efi_tcg2.c b/lib/efi_loader/efi_tcg2.c > index ed86a220fb..d5eca68769 100644 > --- a/lib/efi_loader/efi_tcg2.c > +++ b/lib/efi_loader/efi_tcg2.c > @@ -515,7 +515,7 @@ static efi_status_t tcg2_create_digest(const u8 *input, u32 length, > sha1_context ctx; > sha256_context ctx_256; > sha512_context ctx_512; > - u8 final[TPM2_ALG_SHA512]; > + u8 final[TPM2_SHA512_DIGEST_SIZE]; > efi_status_t ret; > u32 active; > int i; > -- > 2.17.1 > Thanks! Reviewed-by: Ilias Apalodimas