* grub-core/commands/efi/lssal.c: Fix terminating condition.

This commit is contained in:
Vladimir Serbinenko 2013-12-11 15:59:12 +01:00
parent 316dda716c
commit 3e3dff249f
2 changed files with 10 additions and 2 deletions

View file

@ -1,3 +1,7 @@
2013-12-11 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/commands/efi/lssal.c: Fix terminating condition.
2013-12-11 Vladimir Serbinenko <phcoder@gmail.com> 2013-12-11 Vladimir Serbinenko <phcoder@gmail.com>
Introduce grub_efi_packed_guid and use it where alignment is not Introduce grub_efi_packed_guid and use it where alignment is not

View file

@ -32,7 +32,7 @@ disp_sal (void *table)
{ {
struct grub_efi_sal_system_table *t = table; struct grub_efi_sal_system_table *t = table;
void *desc; void *desc;
grub_uint32_t len, l; grub_uint32_t len, l, i;
grub_printf ("SAL rev: %02x, signature: %x, len:%x\n", grub_printf ("SAL rev: %02x, signature: %x, len:%x\n",
t->sal_rev, t->signature, t->total_table_len); t->sal_rev, t->signature, t->total_table_len);
@ -44,7 +44,9 @@ disp_sal (void *table)
desc = t->entries; desc = t->entries;
len = t->total_table_len - sizeof (struct grub_efi_sal_system_table); 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) switch (*(grub_uint8_t *) desc)
{ {
@ -123,6 +125,8 @@ disp_sal (void *table)
return; return;
} }
desc = (grub_uint8_t *)desc + l; desc = (grub_uint8_t *)desc + l;
if (len <= l)
return;
len -= l; len -= l;
} }
} }