]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
commands/efi/tpm: Use grub_strcpy() instead of grub_memcpy()
authorLu Ken <ken.lu@intel.com>
Wed, 13 Jul 2022 02:06:11 +0000 (10:06 +0800)
committerDaniel Kiper <daniel.kiper@oracle.com>
Wed, 27 Jul 2022 17:12:26 +0000 (19:12 +0200)
The event description is a string, so using grub_strcpy() is cleaner than
using grub_memcpy().

Signed-off-by: Lu Ken <ken.lu@intel.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/commands/efi/tpm.c

index 7acf5104998169421635543912a5154b8d280ab6..bb595997214ae6b4f3b7a5dbcb13f7633836e307 100644 (file)
@@ -175,7 +175,7 @@ grub_tpm1_log_event (grub_efi_handle_t tpm_handle, unsigned char *buf,
   event->PCRIndex = pcr;
   event->EventType = EV_IPL;
   event->EventSize = grub_strlen (description) + 1;
-  grub_memcpy (event->Event, description, event->EventSize);
+  grub_strcpy ((char *) event->Event, description);
 
   algorithm = TCG_ALG_SHA;
   status = efi_call_7 (tpm->log_extend_event, tpm, (grub_addr_t) buf, (grub_uint64_t) size,
@@ -212,7 +212,7 @@ grub_tpm2_log_event (grub_efi_handle_t tpm_handle, unsigned char *buf,
   event->Header.EventType = EV_IPL;
   event->Size =
     sizeof (*event) - sizeof (event->Event) + grub_strlen (description) + 1;
-  grub_memcpy (event->Event, description, grub_strlen (description) + 1);
+  grub_strcpy ((char *) event->Event, description);
 
   status = efi_call_5 (tpm->hash_log_extend_event, tpm, 0, (grub_addr_t) buf,
                       (grub_uint64_t) size, event);