struct grub_reiserfs_key entry_key;
enum grub_fshelp_filetype entry_type;
char *entry_name;
+ char *entry_name_end = 0;
+ char c;
if (!(entry_state & GRUB_REISERFS_VISIBLE_MASK))
continue;
entry_name = (((char *) directory_headers)
+ grub_le_to_cpu16 (directory_header->location));
+ if (entry_number == 0)
+ {
+ entry_name_end = (char *) block_header
+ + grub_le_to_cpu16 (item_headers[block_position].item_location)
+ + grub_le_to_cpu16 (item_headers[block_position].item_size);
+ }
+ else
+ {
+ entry_name_end = (((char *) directory_headers)
+ + grub_le_to_cpu16 (directory_headers[entry_number - 1].location));
+ }
+ if (entry_name_end < entry_name || entry_name_end > (char *) block_header + block_size)
+ {
+ entry_name_end = (char *) block_header + block_size;
+ }
+
entry_key.directory_id = directory_header->directory_id;
entry_key.object_id = directory_header->object_id;
entry_key.u.v2.offset_type = 0;
else
{
/* Pseudo file ".." never has stat block. */
- if (grub_strcmp (entry_name, ".."))
+ if (entry_name_end == entry_name + 2 && grub_memcmp (entry_name, "..", 2) != 0)
grub_dprintf ("reiserfs",
"Warning : %s has no stat block !\n",
entry_name);
goto next;
}
}
+
+ c = *entry_name_end;
+ *entry_name_end = 0;
if (hook (entry_name, entry_type, entry_item, hook_data))
{
+ *entry_name_end = c;
grub_dprintf ("reiserfs", "Found : %s, type=%d\n",
entry_name, entry_type);
ret = 1;
goto found;
}
+ *entry_name_end = c;
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)