Skip to content

Commit

Permalink
Changes for error tollerance and code clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimmetz committed Dec 19, 2021
1 parent 8569598 commit 0e3e3a2
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 10 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ AC_PREREQ( 2.59 )

AC_INIT(
[libesedb],
[20211211],
[20211219],
[joachim.metz@gmail.com])

AC_CONFIG_SRCDIR(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ Additional information about long value.
| 0.0.31 | J.B. Metz | December 2019 | Additional information about extended root page header.
| 0.0.32 | J.B. Metz | July 2020 | Updates regarding codepage 1200.
| 0.0.31 | J.B. Metz | October 2021 | Updates regarding Windows 11.
| 0.0.32 | J.B. Metz | December 2021 | Updates regarding Windows 11.
|===

:numbered:
Expand Down Expand Up @@ -330,6 +331,8 @@ Unknown flags
| Value | Identifier | Description
| 0x01000000 | | [yellow-background]*If not set the ECC and checksum counts and date and time values are not shown by eseutil, could be some extended data flag*
| 0x02000000 | | [yellow-background]*Found in STM*
| | |
| 0x01000000 | | [yellow-background]*Found in Windows 11 database*
|===

....
Expand Down
2 changes: 1 addition & 1 deletion libesedb/libesedb_data_definition.c
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,7 @@ int libesedb_data_definition_read_record(
variable_size_data_type_value_size = variable_size_data_type_size - previous_variable_size_data_type_size;

if( ( variable_size_data_type_value_size > record_data_size )
|| ( variable_size_data_type_offset > ( record_data_size - variable_size_data_type_value_size ) ) )
|| ( variable_size_data_type_value_offset > ( record_data_size - variable_size_data_type_value_size ) ) )
{
libcerror_error_set(
error,
Expand Down
20 changes: 12 additions & 8 deletions libesedb/libesedb_file_header.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,10 @@ int libesedb_file_header_read_data(
( (esedb_file_header_t *) data )->file_type,
file_header->file_type );

byte_stream_copy_to_uint32_little_endian(
( (esedb_file_header_t *) data )->database_state,
file_header->database_state );

byte_stream_copy_to_uint32_little_endian(
( (esedb_file_header_t *) data )->format_revision,
file_header->format_revision );
Expand Down Expand Up @@ -295,15 +299,12 @@ int libesedb_file_header_read_data(
28,
0 );

byte_stream_copy_to_uint32_little_endian(
( (esedb_file_header_t *) data )->database_state,
value_32bit );
libcnotify_printf(
"%s: database state\t\t\t\t: %" PRIu32 " ",
function,
value_32bit );
file_header->database_state );
libesedb_debug_print_database_state(
value_32bit );
file_header->database_state );
libcnotify_printf(
"\n" );

Expand Down Expand Up @@ -434,8 +435,9 @@ int libesedb_file_header_read_data(
value_32bit );

libcnotify_printf(
"%s: format revision\t\t\t\t: 0x%08" PRIx32 "\n",
"%s: format revision\t\t\t\t: %" PRIu32 " (0x%08" PRIx32 ")\n",
function,
file_header->format_revision,
file_header->format_revision );
libcnotify_printf(
"%s: page size\t\t\t\t: %" PRIu32 "\n",
Expand Down Expand Up @@ -521,8 +523,9 @@ int libesedb_file_header_read_data(
function,
file_header->creation_format_version );
libcnotify_printf(
"%s: creation format revision\t\t: 0x%08" PRIx32 "\n",
"%s: creation format revision\t\t: %" PRIu32 " (0x%08" PRIx32 ")\n",
function,
file_header->creation_format_revision,
file_header->creation_format_revision );

libcnotify_printf(
Expand Down Expand Up @@ -688,7 +691,8 @@ int libesedb_file_header_read_data(

return( -1 );
}
if( stored_xor32_checksum != calculated_xor32_checksum )
if( ( file_header->database_state != 2 )
&& ( stored_xor32_checksum != calculated_xor32_checksum ) )
{
libcerror_error_set(
error,
Expand Down
4 changes: 4 additions & 0 deletions libesedb/libesedb_file_header.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ struct libesedb_file_header
*/
uint32_t format_version;

/* The database state
*/
uint32_t database_state;

/* The page size
*/
uint32_t page_size;
Expand Down

0 comments on commit 0e3e3a2

Please sign in to comment.