Blame SOURCES/0277-commands-efi-tpm-Use-grub_strcpy-instead-of-grub_mem.patch

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