From 1abf2aa0f6fb8e202667dd09acb860ffd3cfacc5 Mon Sep 17 00:00:00 2001 Message-Id: <1abf2aa0f6fb8e202667dd09acb860ffd3cfacc5.1555700193.git.public@hansmi.ch> 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 --- 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.11.0