Browse Source

efi_loader: fix possible buffer overflow

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>
Masahisa Kojima 3 years ago
parent
commit
b1a7a5e0b8
1 changed files with 1 additions and 1 deletions
  1. 1 1
      lib/efi_loader/efi_tcg2.c

+ 1 - 1
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;