Function grub_strndup may return NULL, this is called from function
grub_ieee1275_get_devname which is then called from function
grub_ieee1275_encode_devname to set device.  The device variable
could then be used with a NULL pointer.

Signed-off-by: Eric Snowberg <[email protected]>
---
 grub-core/kern/ieee1275/openfw.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/grub-core/kern/ieee1275/openfw.c b/grub-core/kern/ieee1275/openfw.c
index 62929d9..4d493ab 100644
--- a/grub-core/kern/ieee1275/openfw.c
+++ b/grub-core/kern/ieee1275/openfw.c
@@ -479,6 +479,9 @@ grub_ieee1275_encode_devname (const char *path)
   char *optr;
   const char *iptr;
 
+  if (! device)
+    return 0;
+
   encoding = grub_malloc (sizeof ("ieee1275/") + 2 * grub_strlen (device)
                          + sizeof (",XXXXXXXXXXXX"));
   if (!encoding)
-- 
1.7.1


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to