grub2/0177-Fix-a-segfault-in-lsef...

34 lines
1.1 KiB
Diff
Raw Normal View History

From 18356b411280c1d6da77198370948505b2e362c4 Mon Sep 17 00:00:00 2001
From: Rob Clark <rclark@redhat.com>
Date: Wed, 19 Jul 2017 15:43:12 -0400
Subject: [PATCH 177/177] Fix a segfault in lsefi
when protocols_per_handle returns error, we can't use the pointers we
passed to it, and that includes trusting num_protocols.
Signed-off-by: Peter Jones <pjones@redhat.com>
---
grub-core/commands/efi/lsefi.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/grub-core/commands/efi/lsefi.c b/grub-core/commands/efi/lsefi.c
index d901c3892..9c0c071c8 100644
--- a/grub-core/commands/efi/lsefi.c
+++ b/grub-core/commands/efi/lsefi.c
@@ -110,7 +110,11 @@ grub_cmd_lsefi (grub_command_t cmd __attribute__ ((unused)),
status = efi_call_3 (grub_efi_system_table->boot_services->protocols_per_handle,
handle, &protocols, &num_protocols);
if (status != GRUB_EFI_SUCCESS)
- grub_printf ("Unable to retrieve protocols\n");
+ {
+ grub_printf ("Unable to retrieve protocols\n");
+ continue;
+ }
+
for (j = 0; j < num_protocols; j++)
{
for (k = 0; k < ARRAY_SIZE (known_protocols); k++)
--
2.13.3