=== modified file 'ChangeLog' --- ChangeLog 2012-09-14 10:23:36 +0000 +++ ChangeLog 2012-09-14 21:46:17 +0000 @@ -1,3 +1,8 @@ +2012-09-14 Paulo Flabiano Smorigo + + * grub-core/kern/ieee1275/init.c (grub_machine_get_bootlocation): Use + dynamic allocation for the bootpath buffer. + 2012-09-14 Colin Watson * grub-core/term/terminfo.c: Only fix up powerpc key repeat on === modified file 'grub-core/kern/ieee1275/init.c' --- grub-core/kern/ieee1275/init.c 2012-06-11 18:44:38 +0000 +++ grub-core/kern/ieee1275/init.c 2012-09-14 21:27:28 +0000 @@ -82,18 +82,28 @@ void grub_machine_get_bootlocation (char **device, char **path) { - char bootpath[64]; /* XXX check length */ + char *bootpath; + grub_ssize_t bootpath_size; char *filename; char *type; - - if (grub_ieee1275_get_property (grub_ieee1275_chosen, "bootpath", &bootpath, - sizeof (bootpath), 0)) + + if (grub_ieee1275_get_property_length (grub_ieee1275_chosen, "bootpath", + &bootpath_size)) { /* Should never happen. */ grub_printf ("/chosen/bootpath property missing!\n"); return; } + bootpath = (char *) grub_malloc ((grub_size_t) bootpath_size); + if (! bootpath) + { + grub_printf ("Cannot allocate bootpath buffer.\n"); + return; + } + grub_ieee1275_get_property (grub_ieee1275_chosen, "bootpath", bootpath, + (grub_size_t) bootpath_size, 0); + /* Transform an OF device path to a GRUB path. */ type = grub_ieee1275_get_device_type (bootpath); @@ -132,6 +142,7 @@ *path = filename; } } + grub_free (bootpath); } /* Claim some available memory in the first /memory node. */