mirror of
https://xff.cz/git/u-boot/
synced 2025-09-01 16:52:14 +02:00
part_dos: fix crash with big sector size
Apple iPod nanos have sector sizes of 2 or 4 KiB, which crashes U-Boot when it tries to read the MBR into 512-byte buffer situated on stack. Instead use the variable length arrays to be safe with any large sector size. Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
This commit is contained in:
committed by
Wolfgang Denk
parent
4204298db0
commit
54193c5d81
@@ -87,7 +87,7 @@ static int test_block_type(unsigned char *buffer)
|
||||
|
||||
int test_part_dos (block_dev_desc_t *dev_desc)
|
||||
{
|
||||
unsigned char buffer[DEFAULT_SECTOR_SIZE];
|
||||
unsigned char buffer[dev_desc->blksz];
|
||||
|
||||
if ((dev_desc->block_read(dev_desc->dev, 0, 1, (ulong *) buffer) != 1) ||
|
||||
(buffer[DOS_PART_MAGIC_OFFSET + 0] != 0x55) ||
|
||||
@@ -102,7 +102,7 @@ int test_part_dos (block_dev_desc_t *dev_desc)
|
||||
static void print_partition_extended (block_dev_desc_t *dev_desc, int ext_part_sector, int relative,
|
||||
int part_num)
|
||||
{
|
||||
unsigned char buffer[DEFAULT_SECTOR_SIZE];
|
||||
unsigned char buffer[dev_desc->blksz];
|
||||
dos_partition_t *pt;
|
||||
int i;
|
||||
|
||||
@@ -166,7 +166,7 @@ static int get_partition_info_extended (block_dev_desc_t *dev_desc, int ext_part
|
||||
int relative, int part_num,
|
||||
int which_part, disk_partition_t *info)
|
||||
{
|
||||
unsigned char buffer[DEFAULT_SECTOR_SIZE];
|
||||
unsigned char buffer[dev_desc->blksz];
|
||||
dos_partition_t *pt;
|
||||
int i;
|
||||
|
||||
|
Reference in New Issue
Block a user