Resolves: CVE-2024-45781 CVE-2024-45783 CVE-2024-45778 Resolves: CVE-2024-45775 CVE-2024-45780 CVE-2024-45774 Resolves: CVE-2025-0690 CVE-2025-1118 CVE-2024-45782 Resolves: CVE-2025-0624 CVE-2024-45779 CVE-2024-45776 Resolves: CVE-2025-0622 CVE-2025-0677 Resolves: #RHEL-80691 Resolves: #RHEL-80690 Resolves: #RHEL-80689 Resolves: #RHEL-80687 Resolves: #RHEL-80686 Signed-off-by: Leo Sandoval <lsandova@redhat.com> Signed-off-by: Nicolas Frayer <nfrayer@redhat.com>
33 lines
1010 B
Diff
33 lines
1010 B
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: B Horn <b@horn.uk>
|
|
Date: Sun, 12 May 2024 11:08:23 +0100
|
|
Subject: [PATCH] commands/ls: Fix NULL dereference
|
|
|
|
The grub_strrchr() may return NULL when the dirname do not contain "/".
|
|
This can happen on broken filesystems.
|
|
|
|
Reported-by: B Horn <b@horn.uk>
|
|
Signed-off-by: B Horn <b@horn.uk>
|
|
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
|
---
|
|
grub-core/commands/ls.c | 6 +++++-
|
|
1 file changed, 5 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/grub-core/commands/ls.c b/grub-core/commands/ls.c
|
|
index 6a1c7f5d3..f660946a2 100644
|
|
--- a/grub-core/commands/ls.c
|
|
+++ b/grub-core/commands/ls.c
|
|
@@ -241,7 +241,11 @@ grub_ls_list_files (char *dirname, int longlist, int all, int human)
|
|
|
|
grub_file_close (file);
|
|
|
|
- p = grub_strrchr (dirname, '/') + 1;
|
|
+ p = grub_strrchr (dirname, '/');
|
|
+ if (p == NULL)
|
|
+ goto fail;
|
|
+ ++p;
|
|
+
|
|
ctx.dirname = grub_strndup (dirname, p - dirname);
|
|
if (ctx.dirname == NULL)
|
|
goto fail;
|