2008-01-15 Robert Millan <rmh@aybabtu.com>

* kern/powerpc/ieee1275/openfw.c (grub_available_iterate): Obtain
        actual size of `available' from grub_ieee1275_get_property(), and
        restrict parsing to that bound.
This commit is contained in:
robertmh 2008-01-15 12:13:45 +00:00
parent 47bf09a4ed
commit 87ae25ebfd
2 changed files with 10 additions and 2 deletions

View file

@ -1,3 +1,9 @@
2008-01-15 Robert Millan <rmh@aybabtu.com>
* kern/powerpc/ieee1275/openfw.c (grub_available_iterate): Obtain
actual size of `available' from grub_ieee1275_get_property(), and
restrict parsing to that bound.
2008-01-15 Christian Franke <franke@computer.org>
* util/grub-emu.c: Replace <argp.h> by <getopt.h>.

View file

@ -141,6 +141,7 @@ grub_err_t grub_available_iterate (int (*hook) (grub_uint64_t, grub_uint64_t))
grub_ieee1275_phandle_t root;
grub_ieee1275_phandle_t memory;
grub_uint32_t available[32];
grub_ssize_t available_size;
int address_cells = 1;
int size_cells = 1;
unsigned int i;
@ -157,13 +158,14 @@ grub_err_t grub_available_iterate (int (*hook) (grub_uint64_t, grub_uint64_t))
return grub_error (GRUB_ERR_UNKNOWN_DEVICE,
"Couldn't find /memory node");
if (grub_ieee1275_get_property (memory, "available", available,
sizeof available, 0))
sizeof available, &available_size))
return grub_error (GRUB_ERR_UNKNOWN_DEVICE,
"Couldn't examine /memory/available property");
/* Decode each entry and call `hook'. */
i = 0;
while (i < sizeof (available))
available_size /= sizeof (grub_uint32_t);
while (i < available_size)
{
grub_uint64_t address;
grub_uint64_t size;