summaryrefslogtreecommitdiff
path: root/lib/fuzzing/fuzz_ndr_X.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/fuzzing/fuzz_ndr_X.c')
-rw-r--r--lib/fuzzing/fuzz_ndr_X.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/fuzzing/fuzz_ndr_X.c b/lib/fuzzing/fuzz_ndr_X.c
index cdc9de50a8c..5fc21dcef26 100644
--- a/lib/fuzzing/fuzz_ndr_X.c
+++ b/lib/fuzzing/fuzz_ndr_X.c
@@ -192,6 +192,20 @@ int LLVMFuzzerTestOneInput(uint8_t *data, size_t size) {
function = SVAL(data, 2);
type = fuzz_packet_flags & 3;
+
+#ifdef FUZZ_TYPE
+ /*
+ * Fuzz targets should have as small an interface as possible.
+ * This allows us to create 3 binaries for most pipes,
+ * TYPE_IN, TYPE_OUT and TYPE_STRUCT
+ *
+ * We keep the header format, and just exit early if it does
+ * not match.
+ */
+ if (type != FUZZ_TYPE) {
+ return 0;
+ }
+#endif
#endif
switch (type) {