From: Michael Hanselmann Date: Thu, 4 Apr 2019 00:26:13 +0000 (+0200) Subject: regfio: Return instead of assert for short blocks X-Git-Tag: ldb-2.0.5~307 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b201dd33e0403d7259b91d4fcd4df2445703a34c;p=thirdparty%2Fsamba.git 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 --- 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) */