2007-05-18 Jeroen Dekkers <jeroen@dekkers.cx>

* kern/disk.c (grub_disk_read): Check return value of
	grub_realloc().
This commit is contained in:
jeroen 2007-05-18 21:40:06 +00:00
parent 260ba823e6
commit 7262eca1e3
2 changed files with 12 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2007-05-18 Jeroen Dekkers <jeroen@dekkers.cx>
* kern/disk.c (grub_disk_read): Check return value of
grub_realloc().
2007-05-18 Jeroen Dekkers <jeroen@dekkers.cx> 2007-05-18 Jeroen Dekkers <jeroen@dekkers.cx>
* util/getroot.c (grub_util_get_grub_dev): Support partitionable * util/getroot.c (grub_util_get_grub_dev): Support partitionable

View file

@ -409,13 +409,19 @@ grub_disk_read (grub_disk_t disk, grub_disk_addr_t sector,
{ {
/* Uggh... Failed. Instead, just read necessary data. */ /* Uggh... Failed. Instead, just read necessary data. */
unsigned num; unsigned num;
char *p;
grub_errno = GRUB_ERR_NONE; grub_errno = GRUB_ERR_NONE;
num = ((size + GRUB_DISK_SECTOR_SIZE - 1) num = ((size + GRUB_DISK_SECTOR_SIZE - 1)
>> GRUB_DISK_SECTOR_BITS); >> GRUB_DISK_SECTOR_BITS);
tmp_buf = grub_realloc (tmp_buf, num << GRUB_DISK_SECTOR_BITS); p = grub_realloc (tmp_buf, num << GRUB_DISK_SECTOR_BITS);
if (!p)
goto finish;
tmp_buf = p;
if ((disk->dev->read) (disk, sector, num, tmp_buf)) if ((disk->dev->read) (disk, sector, num, tmp_buf))
{ {
grub_error_push (); grub_error_push ();