summaryrefslogtreecommitdiff
path: root/source3/registry
diff options
context:
space:
mode:
authorMichael Hanselmann <public@hansmi.ch>2019-04-04 02:26:13 +0200
committerAndrew Bartlett <abartlet@samba.org>2019-06-20 23:40:16 +0000
commitb201dd33e0403d7259b91d4fcd4df2445703a34c (patch)
treec1100ec9cc26aa899b9ac6da92a0ce9b041cb117 /source3/registry
parentd4ace83baaa47fe36dd4b0ab9472933ef09b4eb6 (diff)
downloadsamba-b201dd33e0403d7259b91d4fcd4df2445703a34c.tar.gz
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>
Diffstat (limited to 'source3/registry')
-rw-r--r--source3/registry/regfio.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/source3/registry/regfio.c b/source3/registry/regfio.c
index 32e166a1223..60c865d4d22 100644
--- a/source3/registry/regfio.c
+++ b/source3/registry/regfio.c
@@ -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) */