From: Vladimir 'phcoder' Serbinenko Date: Thu, 24 Mar 2011 11:28:22 +0000 (+0100) Subject: * grub-core/loader/i386/bsdXX.c (grub_freebsd_load_elfmodule): Account X-Git-Tag: 1.99~161 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8bc66a2ce617da1b721f7beebe8b0b164e733ae6;p=thirdparty%2Fgrub.git * grub-core/loader/i386/bsdXX.c (grub_freebsd_load_elfmodule): Account for modules headers when counting the needed allocation size. --- diff --git a/ChangeLog b/ChangeLog index 6e59b97ae..61adf1e26 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-03-24 Vladimir Serbinenko + + * grub-core/loader/i386/bsdXX.c (grub_freebsd_load_elfmodule): Account + for modules headers when counting the needed allocation size. + 2011-03-23 Vladimir Serbinenko * grub-core/term/gfxterm.c (calculate_normal_character_width): Return 8 diff --git a/grub-core/loader/i386/bsdXX.c b/grub-core/loader/i386/bsdXX.c index 5b9e7689e..92d267534 100644 --- a/grub-core/loader/i386/bsdXX.c +++ b/grub-core/loader/i386/bsdXX.c @@ -195,6 +195,11 @@ SUFFIX (grub_freebsd_load_elfmodule) (struct grub_relocator *relocator, chunk_size = s->sh_addr + s->sh_size; } + if (chunk_size < sizeof (e)) + chunk_size = sizeof (e); + chunk_size += e.e_phnum * e.e_phentsize; + chunk_size += e.e_shnum * e.e_shentsize; + { grub_relocator_chunk_t ch;