loader/efi/linux: Correctly terminate load_options member

If a simple string for arguments are passed it should be NUL terminated.
This is true for other code but not for "linux" command.

Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
Frediano Ziglio 2025-06-25 14:42:43 +01:00 committed by Daniel Kiper
parent f3b339af11
commit 249db11d8f

View File

@ -233,6 +233,8 @@ grub_arch_efi_linux_boot_image (grub_addr_t addr, grub_size_t size, char *args)
len = grub_utf8_to_utf16 (loaded_image->load_options, len,
(grub_uint8_t *) args, args_len, NULL);
/* NUL terminate. */
((grub_efi_char16_t *) loaded_image->load_options)[len++] = 0;
loaded_image->load_options_size = len * sizeof (grub_efi_char16_t);
grub_dprintf ("linux", "starting image %p\n", image_handle);