summaryrefslogtreecommitdiff
path: root/source3/registry
diff options
context:
space:
mode:
authorMichael Hanselmann <public@hansmi.ch>2019-09-23 21:53:55 +0000
committerUri Simchoni <uri@samba.org>2019-10-18 07:31:45 +0000
commit6b6df73b4ce20286b1b7370750d11d0d648d7752 (patch)
treea37236d59379aedbf7061cacc5e9e7eff1b1d53e /source3/registry
parente477a94ffd3795d7d8aa83e899e9b0f2f9860a79 (diff)
downloadsamba-6b6df73b4ce20286b1b7370750d11d0d648d7752.tar.gz
regfio: Allow ignoring of checksum
In order to get good coverage fuzzing code has to either calculate checksums correctly or to disable their verification. This change implements the latter for the "REGF_FILE" structure used by the "regfio_*" family of functions. Signed-off-by: Michael Hanselmann <public@hansmi.ch> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Uri Simchoni <uri@samba.org>
Diffstat (limited to 'source3/registry')
-rw-r--r--source3/registry/regfio.c3
-rw-r--r--source3/registry/regfio.h7
2 files changed, 9 insertions, 1 deletions
diff --git a/source3/registry/regfio.c b/source3/registry/regfio.c
index 4c6271cda7a..930ac834d1a 100644
--- a/source3/registry/regfio.c
+++ b/source3/registry/regfio.c
@@ -482,7 +482,7 @@ static bool read_regf_block( REGF_FILE *file )
prs_mem_free( &ps );
- if ( file->checksum != checksum ) {
+ if ( file->checksum != checksum && !file->ignore_checksums) {
DEBUG(0,("read_regf_block: invalid checksum\n" ));
return False;
}
@@ -1242,6 +1242,7 @@ out:
}
ZERO_STRUCTP( rb );
rb->fd = -1;
+ rb->ignore_checksums = false;
if ( !(rb->mem_ctx = talloc_init( "regfio_open" )) ) {
regfio_close( rb );
diff --git a/source3/registry/regfio.h b/source3/registry/regfio.h
index 23a44c9c88a..172427f1985 100644
--- a/source3/registry/regfio.h
+++ b/source3/registry/regfio.h
@@ -199,6 +199,13 @@ typedef struct {
REGF_SK_REC *sec_desc_list; /* list of security descriptors referenced by NK records */
+ /* Ignore checksums in input data. Used by fuzzing code to allow more
+ * coverage without having to calcuate a valid checksum. The checksums
+ * are merely to detect data corruption and don't provide a security
+ * value.
+ */
+ bool ignore_checksums;
+
/* unknowns used to simply writing */
uint32_t unknown1;