efi: check *path non-null before grub_strrchr
The EFI version of grub_machine_get_bootlocation crops the boot image name back to the last / in order to get a directory path. However, it does not check that *name is actually set before calling grub_strrchr to do this, and neither does grub_strrchr before dereferencing a NULL pointer. Parent function, grub_set_prefix_and_root, does check the pointer before using.
This commit is contained in:
parent
72ec399ad8
commit
004a2b1efd
2 changed files with 12 additions and 4 deletions
|
@ -1,3 +1,8 @@
|
|||
2014-01-07 Leif Lindholm <leif.lindholm@linaro.org>
|
||||
|
||||
* grub-core/kern/efi/init.c: check value of *path before
|
||||
dereferencing.
|
||||
|
||||
2014-11-03 Michael Chang <mchang@suse.com>
|
||||
|
||||
* grub-core/net/icmp6.c (grub_net_recv_icmp6_packet): Fix size
|
||||
|
|
|
@ -63,11 +63,14 @@ grub_machine_get_bootlocation (char **device, char **path)
|
|||
if (!*device && grub_efi_net_config)
|
||||
grub_efi_net_config (image->device_handle, device, path);
|
||||
|
||||
if (*path)
|
||||
{
|
||||
/* Get the directory. */
|
||||
p = grub_strrchr (*path, '/');
|
||||
if (p)
|
||||
*p = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
grub_efi_fini (void)
|
||||
|
|
Loading…
Reference in a new issue