From b201dd33e0403d7259b91d4fcd4df2445703a34c Mon Sep 17 00:00:00 2001 From: Michael Hanselmann Date: Thu, 4 Apr 2019 02:26:13 +0200 Subject: [PATCH] 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 Reviewed-by: Andrew Bartlett Reviewed-by: Gary Lockyer --- source3/registry/regfio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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) */ -- 2.47.3