Skip to content

Commit

Permalink
Merge pull request #8 from Everlaw/bugfix/two-pst-fixes
Browse files Browse the repository at this point in the history
Bugfix/two pst fixes
  • Loading branch information
EverlawKilian authored Aug 19, 2024
2 parents 2200396 + f28e7f2 commit 0b6edfc
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 49 deletions.
1 change: 1 addition & 0 deletions libpff/libpff_local_descriptors.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ int libpff_local_descriptors_get_leaf_node_from_node_by_identifier(
{
return( 0 );
}
result = 0;
if( offsets_index_value == NULL )
{
libcerror_error_set(
Expand Down
79 changes: 30 additions & 49 deletions libpff/libpff_name_to_id_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -365,41 +365,34 @@ int libpff_name_to_id_map_read(

goto on_error;
}
if( name_to_id_map_entries_data == NULL )
{
libcerror_error_set(
error,
LIBCERROR_ERROR_DOMAIN_RUNTIME,
LIBCERROR_RUNTIME_ERROR_VALUE_MISSING,
"%s: missing name to id map entries data.",
function );

goto on_error;
}
if( ( name_to_id_map_entries_data_size == 0 )
|| ( name_to_id_map_entries_data_size > (size_t) SSIZE_MAX ) )
{
libcerror_error_set(
error,
LIBCERROR_ERROR_DOMAIN_RUNTIME,
LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS,
"%s: invalid name to id map entries data size value out of bounds.",
function );

goto on_error;
}
if( ( name_to_id_map_entries_data_size % 8 ) != 0 )
{
libcerror_error_set(
error,
LIBCERROR_ERROR_DOMAIN_RUNTIME,
LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE,
"%s: unsupported name to id map entries size.",
function );

goto on_error;
}
number_of_name_to_id_map_entries = (uint32_t) ( name_to_id_map_entries_data_size / 8 );
if( name_to_id_map_entries_data == NULL || name_to_id_map_entries_data_size == 0)
{
number_of_name_to_id_map_entries = 0;
} else {
if(( name_to_id_map_entries_data_size > (size_t) SSIZE_MAX ) )
{
libcerror_error_set(
error,
LIBCERROR_ERROR_DOMAIN_RUNTIME,
LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS,
"%s: invalid name to id map entries data size value out of bounds.",
function );

goto on_error;
}
if( ( name_to_id_map_entries_data_size % 8 ) != 0 )
{
libcerror_error_set(
error,
LIBCERROR_ERROR_DOMAIN_RUNTIME,
LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE,
"%s: unsupported name to id map entries size.",
function );

goto on_error;
}
number_of_name_to_id_map_entries = (uint32_t) ( name_to_id_map_entries_data_size / 8 );
}

if( libpff_table_get_record_entry_by_type(
item_values->table,
Expand Down Expand Up @@ -452,19 +445,7 @@ int libpff_name_to_id_map_read(

goto on_error;
}
if( name_to_id_map_class_identifiers_data == NULL )
{
libcerror_error_set(
error,
LIBCERROR_ERROR_DOMAIN_RUNTIME,
LIBCERROR_RUNTIME_ERROR_VALUE_MISSING,
"%s: missing name to id map class identifiers data.",
function );

goto on_error;
}
if( ( name_to_id_map_class_identifiers_data_size == 0 )
|| ( name_to_id_map_class_identifiers_data_size > (size64_t) SSIZE_MAX ) )
if( (name_to_id_map_class_identifiers_data_size > (size64_t) SSIZE_MAX ) )
{
libcerror_error_set(
error,
Expand Down Expand Up @@ -667,7 +648,7 @@ int libpff_name_to_id_map_entry_read(

return( -1 );
}
if( ( name_to_id_map_class_identifiers_data_size < 16 )
if( ( name_to_id_map_class_identifiers_data_size < 0 )
|| ( name_to_id_map_class_identifiers_data_size > (size_t) SSIZE_MAX ) )
{
libcerror_error_set(
Expand Down

0 comments on commit 0b6edfc

Please sign in to comment.