efi_loader: fix possible buffer overflow
PATCH 1/1 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 <[email protected]>
--- lib/efi_loader/efi_tcg2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/efi_loader/efi_tcg2.c +1 -1
@@ -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;
Signature · 1 line
2.17.1
PATCH 1/1 efi_loader: fix possible buffer overflow
Quoted 24 lines · Masahisa Kojima
Variable "final" will have SHA512 digest, but currently the array size is not sufficient. Let's fix it.
Signed-off-by Masahisa Kojima <[email protected]>--- lib/efi_loader/efi_tcg2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)lib/efi_loader/efi_tcg2.c +1
-1@@ -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;Signature · 1 line
2.17.1
Thanks!
Reviewed-by Ilias Apalodimas <[email protected]>
PATCH 1/1 efi_loader: fix possible buffer overflow
Quoted 28 lines · Ilias Apalodimas
Quoted 22 lines · Masahisa Kojima
Variable "final" will have SHA512 digest, but currently the array size is not sufficient. Let's fix it.
Signed-off-by Masahisa Kojima <[email protected]>--- lib/efi_loader/efi_tcg2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)lib/efi_loader/efi_tcg2.c +1
-2@@ -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; --Quoted 2 lines
2.17.1
Thanks!
Quoted 2 lines
Reviewed-by Ilias Apalodimas <[email protected]>
I have queued the patch for my next pull request.
Reviewed-by Heinrich Schuchardt <[email protected]>