* grub-core/partmap/amiga.c (GRUB_AMIGA_PART_MAGIC): New define.

(amiga_partition_map_iterate): Check "PART" magic to avoid a very long
	loop in case of incorrect amiga partmap.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-12-31 15:00:45 +01:00
parent 307806cb53
commit 275bff5f00
2 changed files with 10 additions and 0 deletions

View file

@ -1,3 +1,9 @@
2010-12-31 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/partmap/amiga.c (GRUB_AMIGA_PART_MAGIC): New define.
(amiga_partition_map_iterate): Check "PART" magic to avoid a very long
loop in case of incorrect amiga partmap.
2010-12-31 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/partmap/amiga.c (GRUB_AMIGA_RDSK_MAGIC): New define.

View file

@ -44,6 +44,7 @@ struct grub_amiga_partition
{
/* "PART". */
grub_uint8_t magic[4];
#define GRUB_AMIGA_PART_MAGIC "PART"
grub_int32_t size;
grub_int32_t checksum;
grub_uint32_t scsihost;
@ -110,6 +111,9 @@ amiga_partition_map_iterate (grub_disk_t disk,
if (grub_disk_read (disk, next, 0, sizeof (apart), &apart))
return grub_errno;
if (grub_memcmp (apart.magic, GRUB_AMIGA_PART_MAGIC,
sizeof (apart.magic)) == 0)
/* Calculate the first block and the size of the partition. */
part.start = (grub_be_to_cpu32 (apart.lowcyl)
* grub_be_to_cpu32 (apart.heads)