diff --git a/ChangeLog b/ChangeLog index da5a10f88..2478f6e53 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-06-09 Yoshinori K. Okuji + + * loader/i386/pc/linux.c (grub_rescue_cmd_initrd): Make sure that + ADDR_MAX does not exceed GRUB_LINUX_INITRD_MAX_ADDRESS. + 2006-06-07 Jeroen Dekkers * include/grub/types.h (grub_host_addr_t): Rename to diff --git a/loader/i386/pc/linux.c b/loader/i386/pc/linux.c index c4049d40b..e9f4f4c2f 100644 --- a/loader/i386/pc/linux.c +++ b/loader/i386/pc/linux.c @@ -322,7 +322,15 @@ grub_rescue_cmd_initrd (int argc, char *argv[]) /* Get the highest address available for the initrd. */ if (grub_le_to_cpu16 (lh->version) >= 0x0203) - addr_max = grub_cpu_to_le32 (lh->initrd_addr_max); + { + addr_max = grub_cpu_to_le32 (lh->initrd_addr_max); + + /* XXX in reality, Linux specifies a bogus value, so + it is necessary to make sure that ADDR_MAX does not exceed + 0x3fffffff. */ + if (addr_max > GRUB_LINUX_INITRD_MAX_ADDRESS) + addr_max = GRUB_LINUX_INITRD_MAX_ADDRESS; + } else addr_max = GRUB_LINUX_INITRD_MAX_ADDRESS;