|
|
a46852 |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
a46852 |
From: Lu Ken <ken.lu@intel.com>
|
|
|
a46852 |
Date: Wed, 13 Jul 2022 10:06:11 +0800
|
|
|
a46852 |
Subject: [PATCH] commands/efi/tpm: Use grub_strcpy() instead of grub_memcpy()
|
|
|
a46852 |
|
|
|
a46852 |
The event description is a string, so using grub_strcpy() is cleaner than
|
|
|
a46852 |
using grub_memcpy().
|
|
|
a46852 |
|
|
|
a46852 |
Signed-off-by: Lu Ken <ken.lu@intel.com>
|
|
|
a46852 |
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
|
|
a46852 |
(cherry picked from commit ef8679b645a63eb9eb191bb9539d7d25a9d6ff3b)
|
|
|
a46852 |
(cherry picked from commit 6d0d478585c435cce50d4025d2301dc0413bc5c0)
|
|
|
a46852 |
---
|
|
|
a46852 |
grub-core/commands/efi/tpm.c | 4 ++--
|
|
|
a46852 |
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
a46852 |
|
|
|
a46852 |
diff --git a/grub-core/commands/efi/tpm.c b/grub-core/commands/efi/tpm.c
|
|
|
a46852 |
index 7acf510499..bb59599721 100644
|
|
|
a46852 |
--- a/grub-core/commands/efi/tpm.c
|
|
|
a46852 |
+++ b/grub-core/commands/efi/tpm.c
|
|
|
a46852 |
@@ -175,7 +175,7 @@ grub_tpm1_log_event (grub_efi_handle_t tpm_handle, unsigned char *buf,
|
|
|
a46852 |
event->PCRIndex = pcr;
|
|
|
a46852 |
event->EventType = EV_IPL;
|
|
|
a46852 |
event->EventSize = grub_strlen (description) + 1;
|
|
|
a46852 |
- grub_memcpy (event->Event, description, event->EventSize);
|
|
|
a46852 |
+ grub_strcpy ((char *) event->Event, description);
|
|
|
a46852 |
|
|
|
a46852 |
algorithm = TCG_ALG_SHA;
|
|
|
a46852 |
status = efi_call_7 (tpm->log_extend_event, tpm, (grub_addr_t) buf, (grub_uint64_t) size,
|
|
|
a46852 |
@@ -212,7 +212,7 @@ grub_tpm2_log_event (grub_efi_handle_t tpm_handle, unsigned char *buf,
|
|
|
a46852 |
event->Header.EventType = EV_IPL;
|
|
|
a46852 |
event->Size =
|
|
|
a46852 |
sizeof (*event) - sizeof (event->Event) + grub_strlen (description) + 1;
|
|
|
a46852 |
- grub_memcpy (event->Event, description, grub_strlen (description) + 1);
|
|
|
a46852 |
+ grub_strcpy ((char *) event->Event, description);
|
|
|
a46852 |
|
|
|
a46852 |
status = efi_call_5 (tpm->hash_log_extend_event, tpm, 0, (grub_addr_t) buf,
|
|
|
a46852 |
(grub_uint64_t) size, event);
|