nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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