]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* grub-core/loader/multiboot.c (grub_cmd_module): Don't attempt to
authorVladimir Serbinenko <phcoder@gmail.com>
Mon, 28 Oct 2013 13:27:19 +0000 (14:27 +0100)
committerVladimir Serbinenko <phcoder@gmail.com>
Mon, 28 Oct 2013 13:27:19 +0000 (14:27 +0100)
allocate space for zero-sized modules.

ChangeLog
grub-core/loader/multiboot.c

index 4b69844d9d0850c1f671678ba8927232d0c069da..7319fb8cf964bb128be904a44a996b7cc78afc87 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-10-28  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * grub-core/loader/multiboot.c (grub_cmd_module): Don't attempt to
+       allocate space for zero-sized modules.
+
 2013-10-28  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * grub-core/loader/xnu_resume.c (grub_xnu_resume): Reject empty images.
index a37826c5d0307d22d5f0c760a60cdb37f4e63508..7b67349230c97befd6a77eba3823f1b0e1f9a514 100644 (file)
@@ -316,6 +316,7 @@ grub_cmd_module (grub_command_t cmd __attribute__ ((unused)),
     return grub_errno;
 
   size = grub_file_size (file);
+  if (size)
   {
     grub_relocator_chunk_t ch;
     err = grub_relocator_alloc_chunk_align (grub_multiboot_relocator, &ch,
@@ -330,6 +331,11 @@ grub_cmd_module (grub_command_t cmd __attribute__ ((unused)),
     module = get_virtual_current_address (ch);
     target = get_physical_target_address (ch);
   }
+  else
+    {
+      module = 0;
+      target = 0;
+    }
 
   err = grub_multiboot_add_module (target, size, argc - 1, argv + 1);
   if (err)
@@ -338,7 +344,7 @@ grub_cmd_module (grub_command_t cmd __attribute__ ((unused)),
       return err;
     }
 
-  if (grub_file_read (file, module, size) != size)
+  if (size && grub_file_read (file, module, size) != size)
     {
       grub_file_close (file);
       if (!grub_errno)
@@ -348,7 +354,7 @@ grub_cmd_module (grub_command_t cmd __attribute__ ((unused)),
     }
 
   grub_file_close (file);
-  return GRUB_ERR_NONE;;
+  return GRUB_ERR_NONE;
 }
 
 static grub_command_t cmd_multiboot, cmd_module;