about summary refs log tree commit diff
path: root/unicorn_mode/samples/persistent
diff options
context:
space:
mode:
authorDominik Maier <domenukk@gmail.com>2020-06-09 03:03:21 +0200
committerDominik Maier <domenukk@gmail.com>2020-06-09 03:03:21 +0200
commit92b8c5bb6037cb6626682653eacaa124504c592b (patch)
tree23976001fee17bd4da81ee965173a24e85bb947b /unicorn_mode/samples/persistent
parent646237e234f74f7f70780f1d880e666fcf75c65e (diff)
downloadafl++-92b8c5bb6037cb6626682653eacaa124504c592b.tar.gz
fixed shmap fuzzing
Diffstat (limited to 'unicorn_mode/samples/persistent')
-rw-r--r--unicorn_mode/samples/persistent/Makefile2
-rw-r--r--unicorn_mode/samples/persistent/harness.c10
2 files changed, 11 insertions, 1 deletions
diff --git a/unicorn_mode/samples/persistent/Makefile b/unicorn_mode/samples/persistent/Makefile
index cd43bf02..80a47550 100644
--- a/unicorn_mode/samples/persistent/Makefile
+++ b/unicorn_mode/samples/persistent/Makefile
@@ -38,7 +38,7 @@ harness.o: harness.c ../../unicornafl/include/unicorn/*.h
 	${MYCC} ${CFLAGS} -O3 -c harness.c
 
 harness-debug.o: harness.c ../../unicornafl/include/unicorn/*.h
-	${MYCC} ${CFLAGS} -g -c harness.c -o $@
+	${MYCC} ${CFLAGS} -DAFL_DEBUG=1 -g -c harness.c -o $@
 
 harness: harness.o
 	${MYCC} -L${LIBDIR} harness.o ../../unicornafl/libunicornafl.a $(LDFLAGS) -o $@
diff --git a/unicorn_mode/samples/persistent/harness.c b/unicorn_mode/samples/persistent/harness.c
index a30af109..30013b4c 100644
--- a/unicorn_mode/samples/persistent/harness.c
+++ b/unicorn_mode/samples/persistent/harness.c
@@ -129,6 +129,16 @@ static bool place_input_callback(
         return false;
     }
 
+#if defined(AFL_DEBUG)
+    printf("[d] harness: input len=%ld, [ ", input_len);
+    int i = 0;
+    for (i = 0; i < input_len && i < 16; i++) {
+        printf("0x%02x ", (unsigned char) input[i]);
+    }
+    if (input_len > 16) printf("... ");
+    printf("]\n");
+#endif
+
     // For persistent mode, we have to set up stack and memory each time.
     uc_reg_write(uc, UC_X86_REG_RIP, &CODE_ADDRESS); // Set the instruction pointer back
     // Set up the function parameters accordingly RSI, RDI (see calling convention/disassembly)