grub-devel
[Top][All Lists]
Advanced

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

Re: Issue in cvs kern/elf.c


From: Jerone Young
Subject: Re: Issue in cvs kern/elf.c
Date: Wed, 18 Apr 2007 17:37:50 -0500

This is an obvious problem. Thanks for finding it Pattrick! I will
commit the fix today.

On 4/18/07, Pattrick Hueper <address@hidden> wrote:
Hi all,

testing grub2 on a 64bit platform i found an issue in kern/elf.c method
grub_elf64_load.

There are parentheses missing after the compare of read bytes and expected
filesize causing the load to always fail with GRUB_ERR_BAD_OS.

Here is the cvs patch that fixed the issue for me:

Index: kern/elf.c
===================================================================
RCS file: /cvsroot/grub/grub2/kern/elf.c,v
retrieving revision 1.5
diff -u -r1.5 elf.c
--- kern/elf.c  20 Feb 2007 22:46:12 -0000      1.5
+++ kern/elf.c  18 Apr 2007 09:02:44 -0000
@@ -432,12 +432,14 @@
        grub_ssize_t read;
        read = grub_file_read (elf->file, (void *) load_addr,
phdr->p_filesz);
        if (read != (grub_ssize_t) phdr->p_filesz)
-         /* XXX How can we free memory from `load_hook'?  */
-         grub_error_push ();
-         return grub_error (GRUB_ERR_BAD_OS,
-                            "Couldn't read segment from file: "
-                            "wanted 0x%lx bytes; read 0x%lx bytes.",
-                            phdr->p_filesz, read);
+          {
+           /* XXX How can we free memory from `load_hook'?  */
+           grub_error_push ();
+           return grub_error (GRUB_ERR_BAD_OS,
+                            "Couldn't read segment from file: "
+                            "wanted 0x%lx bytes; read 0x%lx bytes.",
+                            phdr->p_filesz, read);
+          }
       }

     if (phdr->p_filesz < phdr->p_memsz)


Best Regards, Pattrick

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






reply via email to

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