On Wed, Jun 25, 2025 at 1:41 PM Daniel Kiper <dki...@net-space.pl> wrote:
>
> In general patches #1, #2, #4 and #5 make sense for me. So, you can add
> my RB there...
>
> On Wed, Jun 25, 2025 at 07:42:27AM +0100, Frediano Ziglio via Grub-devel 
> wrote:
> > 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.zig...@cloud.com>
> > ---
> > Changes since v1
> > - remove useless assignment.
> >
> > Changes since v2
> > - split changes;
> > - correct spacing.
> > ---
> >  grub-core/loader/efi/linux.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c
> > index 9df49150e..e53593408 100644
> > --- a/grub-core/loader/efi/linux.c
> > +++ b/grub-core/loader/efi/linux.c
> > @@ -231,6 +231,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, (grub_size_t) -1, NULL);
> > +  /* NUL terminate */
> > +  ((grub_efi_char16_t *) loaded_image->load_options)[len++] = 0;
>
> It seems to me this is due to lack of termination in the earlier GRUB args
> copy. So, probably this should be fixed there. grub_strncpy() instead of
> grub_memcpy()? If you do that then probably my comment for #3 does not
> make a lot of sense.
>

I would say the issue is that grub_utf8_to_utf16 is not
NUL-terminating the string. Well, not an issue itself, just that in
this case we want the buffer NUL-terminated.

> And patch set misses cover letter...
>

Doing it.

> Daniel

Frediano

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

Reply via email to