From 3e3dff249f37878e8a1278befbd6bdc2da9cfc9f Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Wed, 11 Dec 2013 15:59:12 +0100 Subject: [PATCH] * grub-core/commands/efi/lssal.c: Fix terminating condition. --- ChangeLog | 4 ++++ grub-core/commands/efi/lssal.c | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 385155b44..ad5daf02a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-12-11 Vladimir Serbinenko + + * grub-core/commands/efi/lssal.c: Fix terminating condition. + 2013-12-11 Vladimir Serbinenko Introduce grub_efi_packed_guid and use it where alignment is not diff --git a/grub-core/commands/efi/lssal.c b/grub-core/commands/efi/lssal.c index d123389fd..5084ddd8b 100644 --- a/grub-core/commands/efi/lssal.c +++ b/grub-core/commands/efi/lssal.c @@ -32,7 +32,7 @@ disp_sal (void *table) { struct grub_efi_sal_system_table *t = table; void *desc; - grub_uint32_t len, l; + grub_uint32_t len, l, i; grub_printf ("SAL rev: %02x, signature: %x, len:%x\n", t->sal_rev, t->signature, t->total_table_len); @@ -44,7 +44,9 @@ disp_sal (void *table) desc = t->entries; len = t->total_table_len - sizeof (struct grub_efi_sal_system_table); - while (len > 0) + if (t->total_table_len <= sizeof (struct grub_efi_sal_system_table)) + return; + for (i = 0; i < t->entry_count; i++) { switch (*(grub_uint8_t *) desc) { @@ -123,6 +125,8 @@ disp_sal (void *table) return; } desc = (grub_uint8_t *)desc + l; + if (len <= l) + return; len -= l; } } -- 2.47.2