grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Silently ignore grub_file_read when p_filesz == 0


From: Bean
Subject: Re: [PATCH] Silently ignore grub_file_read when p_filesz == 0
Date: Mon, 24 Mar 2008 19:17:03 +0800

On Fri, Mar 21, 2008 at 7:29 PM, Kalamatee <address@hidden> wrote:
> After reading through the ELF specs
> (http://www.muppetlabs.com/~breadbox/software/ELF.txt) its become clear that
> a PT_LOAD with p_filesz == 0,is valid - and after checking some elf binaries
> ive found a number of cases where this is true (including the bootstrap of
> AROS64)
>
> please find a patch enclosed to change the behaviour of multiboot.c's elf
> loader to silently ignore loading the data if p_filesz == 0
>
> 2008-03-21  Kalamatee address@hidden
>
>         * loader/i386/pc/multiboot.c
>         (grub_multiboot_load_elf32): If p_filesz == 0, do not attempt to
> read data from the file.
>         (grub_multiboot_load_elf64): If p_filesz == 0, do not attempt to
> read data from the file.

I think the better way to fix this problem is to change grub_file_read
itself, as using length 0 as a indicator to read until the end of file
is not consistent with the standard read function, and it could easily
cause buffer overflown problem. However, i don't know if any part of
grub2 is actually rely on this feature, so need to check with it
first.

-- 
Bean




reply via email to

[Prev in Thread] Current Thread [Next in Thread]