ieee1275: Fix segfault in grub-ofpathname
authorEric Snowberg <eric.snowberg@oracle.com>
Tue, 28 Nov 2017 19:51:39 +0000 (11:51 -0800)
committerDaniel Kiper <daniel.kiper@oracle.com>
Wed, 6 Dec 2017 11:55:55 +0000 (12:55 +0100)
Signed-off-by: Eric Snowberg <eric.snowberg@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
util/ieee1275/grub-ofpathname.c

index 8e5d766..300fbdd 100644 (file)
@@ -46,7 +46,9 @@ int main(int argc, char **argv)
     }
 
   of_path = grub_util_devname_to_ofpath (argv[1]);
-  printf("%s\n", of_path);
+
+  if (of_path)
+    printf ("%s\n", of_path);
 
   free (of_path);