]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
regfio: Return instead of assert for short blocks
authorMichael Hanselmann <public@hansmi.ch>
Thu, 4 Apr 2019 00:26:13 +0000 (02:26 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 20 Jun 2019 23:40:16 +0000 (23:40 +0000)
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>
source3/registry/regfio.c

index 32e166a122304bd1dabf677a514150165a73e31f..60c865d4d2268f1d0b8d5d1640f58d5d2bdcc2ba 100644 (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) */