* grub-core/fs/reiserfs.c (grub_reiserfs_iterate_dir): Put a trailing
zero after directory block since last entry may be not 0-terminated if it ends on block boundary. Use continue instead of if spanning whole loop.
This commit is contained in:
parent
a3a0eace51
commit
1516bfb43a
2 changed files with 173 additions and 165 deletions
|
@ -1,3 +1,10 @@
|
|||
2012-05-03 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/fs/reiserfs.c (grub_reiserfs_iterate_dir): Put a trailing
|
||||
zero after directory block since last entry may be not 0-terminated if
|
||||
it ends on block boundary. Use continue instead of if spanning whole
|
||||
loop.
|
||||
|
||||
2012-05-03 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Support 4K sectors UDF inline files.
|
||||
|
|
|
@ -749,7 +749,7 @@ grub_reiserfs_iterate_dir (grub_fshelp_node_t item,
|
|||
goto fail;
|
||||
}
|
||||
block_size = grub_le_to_cpu16 (data->superblock.block_size);
|
||||
block_header = grub_malloc (block_size);
|
||||
block_header = grub_malloc (block_size + 1);
|
||||
if (! block_header)
|
||||
goto fail;
|
||||
block_number = item->block_number;
|
||||
|
@ -770,6 +770,8 @@ grub_reiserfs_iterate_dir (grub_fshelp_node_t item,
|
|||
if (grub_errno)
|
||||
goto fail;
|
||||
|
||||
((char *) block_header)[block_size] = 0;
|
||||
|
||||
#if 0
|
||||
if (grub_le_to_cpu16 (block_header->level) != 1)
|
||||
{
|
||||
|
@ -793,14 +795,14 @@ grub_reiserfs_iterate_dir (grub_fshelp_node_t item,
|
|||
= &directory_headers[entry_number];
|
||||
grub_uint16_t entry_state
|
||||
= grub_le_to_cpu16 (directory_header->state);
|
||||
|
||||
if (entry_state & GRUB_REISERFS_VISIBLE_MASK)
|
||||
{
|
||||
grub_fshelp_node_t entry_item;
|
||||
struct grub_reiserfs_key entry_key;
|
||||
enum grub_reiserfs_item_type entry_type;
|
||||
char *entry_name;
|
||||
|
||||
if (!(entry_state & GRUB_REISERFS_VISIBLE_MASK))
|
||||
continue;
|
||||
|
||||
entry_name = (((char *) directory_headers)
|
||||
+ grub_le_to_cpu16 (directory_header->location));
|
||||
entry_key.directory_id = directory_header->directory_id;
|
||||
|
@ -963,12 +965,11 @@ grub_reiserfs_iterate_dir (grub_fshelp_node_t item,
|
|||
goto found;
|
||||
}
|
||||
|
||||
next:
|
||||
next:
|
||||
*entry_name = 0; /* Make sure next entry name (which is just
|
||||
before this one in disk order) stops before
|
||||
the current one. */
|
||||
}
|
||||
}
|
||||
|
||||
if (next_offset == 0)
|
||||
break;
|
||||
|
|
Loading…
Add table
Reference in a new issue