1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

regfio: Return instead of assert for short blocks

Assertions should only be used when there's absolutely no recovery or to
verify data structure invariants. In this case the supplied registry
hive file may have a malformed block with a size of zero. Such a block
should not terminate the whole program.

Signed-off-by: Michael Hanselmann <public@hansmi.ch>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
This commit is contained in:
Michael Hanselmann 2019-04-04 02:26:13 +02:00 committed by Andrew Bartlett
parent d4ace83baa
commit b201dd33e0

View File

@ -552,7 +552,8 @@ static REGF_HBIN* read_hbin_block( REGF_FILE *file, off_t offset )
if ( !prs_uint32( "header", &hbin->ps, 0, &header ) )
return NULL;
SMB_ASSERT( record_size != 0 );
if (record_size == 0)
return NULL;
if ( record_size & 0x80000000 ) {
/* absolute_value(record_size) */