ieee1275: NULL pointer dereference in grub_machine_get_bootlocation()

Read from NULL pointer canon in function grub_machine_get_bootlocation().
Function grub_ieee1275_canonicalise_devname() may return NULL.

Signed-off-by: Eric Snowberg <eric.snowberg@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
Eric Snowberg 2018-03-14 08:51:17 -07:00 committed by Daniel Kiper
parent e2faabacff
commit 5ceb55b7a0

View file

@ -110,6 +110,8 @@ grub_machine_get_bootlocation (char **device, char **path)
char *ptr;
dev = grub_ieee1275_get_aliasdevname (bootpath);
canon = grub_ieee1275_canonicalise_devname (dev);
if (! canon)
return;
ptr = canon + grub_strlen (canon) - 1;
while (ptr > canon && (*ptr == ',' || *ptr == ':'))
ptr--;