Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions libfsxfs/libfsxfs_volume.c
Original file line number Diff line number Diff line change
Expand Up @@ -2349,6 +2349,8 @@ static int libfsxfs_allocation_group_traverse_alloc_tree(
uint16_t num_records = 0;
uint16_t record_index = 0;
uint32_t magic_number = 0;
const size_t rec_size = 8;
const size_t ptr_size = 4;

if( file_io_handle == NULL )
{
Expand Down Expand Up @@ -2417,12 +2419,10 @@ static int libfsxfs_allocation_group_traverse_alloc_tree(
if( magic_number == LIBFSXFS_BB_V5_MAGIC_NUMBER )
{
header_size = 56;
max_records = 505;
}
else if( magic_number == LIBFSXFS_BB_V4_MAGIC_NUMBER )
{
header_size = 18;
max_records = 509;
header_size = 16;
}
else
{
Expand All @@ -2444,9 +2444,8 @@ static int libfsxfs_allocation_group_traverse_alloc_tree(

if( tree_level > 1 )
{
size_t key_size = 4;
size_t ptr_size = 4;
size_t pointer_array_start = header_size + ( max_records * key_size );
max_records = (block_size - header_size) / (rec_size + ptr_size);
size_t pointer_array_start = header_size + ( max_records * rec_size );

for( record_index = 0; record_index < num_records; record_index++ )
{
Expand Down Expand Up @@ -2479,10 +2478,8 @@ static int libfsxfs_allocation_group_traverse_alloc_tree(
}
}
}
else if( tree_level == 1 )
else
{
size_t rec_size = 8;

for( record_index = 0; record_index < num_records; record_index++ )
{
uint32_t start_block = 0;
Expand Down