2008-09-22 Bean <bean123ch@gmail.com>
* fs/ntfs.c (grub_ntfs_iterate_dir): Fix a rare case where $BITMAP is resident and in attribute list. * include/grub/ntfs.h (BMP_LEN): Removed.
This commit is contained in:
parent
c40fd116ea
commit
a91b6c7c8f
3 changed files with 30 additions and 28 deletions
|
@ -1,3 +1,10 @@
|
|||
2008-09-22 Bean <bean123ch@gmail.com>
|
||||
|
||||
* fs/ntfs.c (grub_ntfs_iterate_dir): Fix a rare case where $BITMAP is
|
||||
resident and in attribute list.
|
||||
|
||||
* include/grub/ntfs.h (BMP_LEN): Removed.
|
||||
|
||||
2008-09-22 Bean <bean123ch@gmail.com>
|
||||
|
||||
* disk/ata.c (grub_apapi_open): Initialize devfnd, no need to set
|
||||
|
|
49
fs/ntfs.c
49
fs/ntfs.c
|
@ -697,35 +697,32 @@ grub_ntfs_iterate_dir (grub_fshelp_node_t dir,
|
|||
(u32at (cur_pos, ofs) == 0x490024) &&
|
||||
(u32at (cur_pos, ofs + 4) == 0x300033))
|
||||
{
|
||||
if ((at->flags & AF_ALST) && (cur_pos[8] == 0))
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FS,
|
||||
"$BITMAP should be non-resident when in attribute list");
|
||||
goto done;
|
||||
}
|
||||
if (cur_pos[8] == 0)
|
||||
{
|
||||
bitmap = (unsigned char *) (cur_pos + u16at (cur_pos, 0x14));
|
||||
bitmap_len = u32at (cur_pos, 0x10);
|
||||
break;
|
||||
}
|
||||
if (u32at (cur_pos, 0x28) > BMP_LEN)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FS, "Non-resident $BITMAP too large");
|
||||
goto done;
|
||||
}
|
||||
bmp = grub_malloc (u32at (cur_pos, 0x28));
|
||||
if (bmp == NULL)
|
||||
goto done;
|
||||
int is_resident = (cur_pos[8] == 0);
|
||||
|
||||
bitmap = (unsigned char *) bmp;
|
||||
bitmap_len = u32at (cur_pos, 0x30);
|
||||
if (read_data (at, cur_pos, bmp, 0, u32at (cur_pos, 0x28), 0, 0))
|
||||
bitmap_len = ((is_resident) ? u32at (cur_pos, 0x10) :
|
||||
(cur_pos, 0x28));
|
||||
|
||||
bmp = grub_malloc (bitmap_len);
|
||||
if (bmp == NULL)
|
||||
goto done;
|
||||
|
||||
if (is_resident)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FS,
|
||||
"Fails to read non-resident $BITMAP");
|
||||
goto done;
|
||||
grub_memcpy (bmp, (char *) (cur_pos + u16at (cur_pos, 0x14)),
|
||||
bitmap_len);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (read_data (at, cur_pos, bmp, 0, bitmap_len, 0, 0))
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FS,
|
||||
"Fails to read non-resident $BITMAP");
|
||||
goto done;
|
||||
}
|
||||
bitmap_len = u32at (cur_pos, 0x30);
|
||||
}
|
||||
|
||||
bitmap = (unsigned char *) bmp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,8 +75,6 @@
|
|||
#define COM_LEN 4096
|
||||
#define COM_SEC (COM_LEN >> BLK_SHR)
|
||||
|
||||
#define BMP_LEN 4096
|
||||
|
||||
#define AF_ALST 1
|
||||
#define AF_MMFT 2
|
||||
#define AF_GPOS 4
|
||||
|
|
Loading…
Reference in a new issue