]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
efi_loader: fix possible buffer overflow
authorMasahisa Kojima <masahisa.kojima@linaro.org>
Wed, 14 Apr 2021 02:55:49 +0000 (11:55 +0900)
committerHeinrich Schuchardt <xypron.glpk@gmx.de>
Sat, 17 Apr 2021 18:01:32 +0000 (20:01 +0200)
Variable "final" will have SHA512 digest, but currently
the array size is not sufficient. Let's fix it.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
lib/efi_loader/efi_tcg2.c

index ed86a220fbd60984184892d5b7f4ad4cfc9bddb6..d5eca68769b00b55a3c302dca6ced0382018208d 100644 (file)
@@ -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;