]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* grub-core/loader/i386/bsdXX.c (grub_freebsd_load_elfmodule): Account
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Thu, 24 Mar 2011 11:28:22 +0000 (12:28 +0100)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Thu, 24 Mar 2011 11:28:22 +0000 (12:28 +0100)
for modules headers when counting the needed allocation size.

ChangeLog
grub-core/loader/i386/bsdXX.c

index 6e59b97aecbc2b148cc87ee12dd22cf62c12ecfe..61adf1e261a24af575f6ed64007eb6aecaa2be51 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-03-24  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * 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  <phcoder@gmail.com>
 
        * grub-core/term/gfxterm.c (calculate_normal_character_width): Return 8
index 5b9e7689eb270dcc4bc44bb13c9be45bead380fc..92d2675348576152f89b3d10705ef71c7044c5cb 100644 (file)
@@ -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;