Blame SOURCES/0428-commands-ls-Require-device_name-is-not-NULL-before-p.patch

9723a8
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
9723a8
From: Daniel Axtens <dja@axtens.net>
9723a8
Date: Mon, 11 Jan 2021 16:57:37 +1100
9723a8
Subject: [PATCH] commands/ls: Require device_name is not NULL before printing
9723a8
9723a8
This can be triggered with:
9723a8
  ls -l (0 0*)
9723a8
and causes a NULL deref in grub_normal_print_device_info().
9723a8
9723a8
I'm not sure if there's any implication with the IEEE 1275 platform.
9723a8
9723a8
Signed-off-by: Daniel Axtens <dja@axtens.net>
9723a8
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
9723a8
---
9723a8
 grub-core/commands/ls.c | 2 +-
9723a8
 1 file changed, 1 insertion(+), 1 deletion(-)
9723a8
9723a8
diff --git a/grub-core/commands/ls.c b/grub-core/commands/ls.c
3efed6
index 2cdb2acc552..d4dcffd3168 100644
9723a8
--- a/grub-core/commands/ls.c
9723a8
+++ b/grub-core/commands/ls.c
9723a8
@@ -196,7 +196,7 @@ grub_ls_list_files (char *dirname, int longlist, int all, int human)
9723a8
       goto fail;
9723a8
     }
9723a8
 
9723a8
-  if (! *path)
9723a8
+  if (! *path && device_name)
9723a8
     {
9723a8
       if (grub_errno == GRUB_ERR_UNKNOWN_FS)
9723a8
 	grub_errno = GRUB_ERR_NONE;