All of lore.kernel.org
 help / color / mirror / Atom feed
From: Frediano Ziglio via Grub-devel <grub-devel@gnu.org>
To: grub-devel@gnu.org
Cc: Frediano Ziglio <frediano.ziglio@cloud.com>
Subject: [PATCH v3 3/6] loader/efi/linux: Do not pass excessive size for source string
Date: Wed, 25 Jun 2025 07:42:24 +0100	[thread overview]
Message-ID: <20250625064229.17960-3-frediano.ziglio@cloud.com> (raw)
In-Reply-To: <20250625064229.17960-1-frediano.ziglio@cloud.com>

The size passed to grub_utf8_to_utf16 for the source string is
used as a limit for the string if NUL character is not encountered
however len, which is strlen(src)*2+2 is surely greater than
strlen(src).
Pass (grub_size_t) -1 to consider only NUL terminator.

Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
---
 grub-core/loader/efi/linux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c
index ba268eccb..5befce4d7 100644
--- a/grub-core/loader/efi/linux.c
+++ b/grub-core/loader/efi/linux.c
@@ -231,7 +231,7 @@ grub_arch_efi_linux_boot_image (grub_addr_t addr, grub_size_t size, char *args)
 
   loaded_image->load_options_size =
     2 * grub_utf8_to_utf16 (loaded_image->load_options, len,
-			    (grub_uint8_t *) args, len, NULL);
+			    (grub_uint8_t *) args, (grub_size_t) -1, NULL);
 
   grub_dprintf ("linux", "starting image %p\n", image_handle);
   status = b->start_image (image_handle, 0, NULL);
-- 
2.49.0


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

  parent reply	other threads:[~2025-06-25  6:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-25  6:42 [PATCH v3 1/6] loader/efi/linux: Remove useless assignment Frediano Ziglio via Grub-devel
2025-06-25  6:42 ` [PATCH v3 2/6] include/grub/charset.h: Update documentation Frediano Ziglio via Grub-devel
2025-06-25  6:42 ` Frediano Ziglio via Grub-devel [this message]
2025-06-25 12:27   ` [PATCH v3 3/6] loader/efi/linux: Do not pass excessive size for source string Daniel Kiper
2025-06-25 13:03     ` Frediano Ziglio via Grub-devel
2025-06-25  6:42 ` [PATCH v3 4/6] loader/efi/linux: Use proper type for "len" variable Frediano Ziglio via Grub-devel
2025-06-25  6:42 ` [PATCH v3 5/6] loader/efi/linux: Use sizeof instead of constant Frediano Ziglio via Grub-devel
2025-06-25  6:42 ` [PATCH v3 6/6] loader/efi/linux: Correctly terminate LoadOptions field Frediano Ziglio via Grub-devel
2025-06-25 12:41   ` Daniel Kiper
2025-06-25 13:27     ` Frediano Ziglio via Grub-devel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250625064229.17960-3-frediano.ziglio@cloud.com \
    --to=grub-devel@gnu.org \
    --cc=frediano.ziglio@cloud.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.