about summary refs log tree commit diff
path: root/examples/aflpp_driver/aflpp_driver.cpp
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2020-06-12 11:57:54 +0200
committervan Hauser <vh@thc.org>2020-06-12 11:57:54 +0200
commitdb2e04361da8f40a7ee99fef1c2a2ed8f08b0501 (patch)
treeec9dd5775159f1924e386ccdd18cc69b765e54d4 /examples/aflpp_driver/aflpp_driver.cpp
parent7d19b108c49510aaa437a855f2732107b770066d (diff)
downloadafl++-db2e04361da8f40a7ee99fef1c2a2ed8f08b0501.tar.gz
shm debug and fixes
Diffstat (limited to 'examples/aflpp_driver/aflpp_driver.cpp')
-rw-r--r--examples/aflpp_driver/aflpp_driver.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/examples/aflpp_driver/aflpp_driver.cpp b/examples/aflpp_driver/aflpp_driver.cpp
index 88354912..68a1783f 100644
--- a/examples/aflpp_driver/aflpp_driver.cpp
+++ b/examples/aflpp_driver/aflpp_driver.cpp
@@ -230,6 +230,8 @@ static int ExecuteFilesOnyByOne(int argc, char **argv) {
 }
 
 int main(int argc, char **argv) {
+  unsigned char in_buf[1024000];
+  size_t in_buf_len;
   Printf(
       "======================= INFO =========================\n"
       "This binary is built for AFL-fuzz.\n"
@@ -278,10 +280,16 @@ int main(int argc, char **argv) {
   while (__afl_persistent_loop(N)) {
 #ifdef _DEBUG
     fprintf(stderr, "CLIENT crc: %08x len: %u\n", hash32(__afl_fuzz_ptr, *__afl_fuzz_len, 0xa5b35705), *__afl_fuzz_len);
+    fprintf(stderr, "RECV:");
+    for (int i = 0; i < *__afl_fuzz_len; i++)
+      fprintf(stderr, "%02x", __afl_fuzz_ptr[i]);
+    fprintf(stderr,"\n");
 #endif
     if (*__afl_fuzz_len) {
       num_runs++;
-      LLVMFuzzerTestOneInput(__afl_fuzz_ptr, *__afl_fuzz_len);
+      in_buf_len = *__afl_fuzz_len;
+      memcpy(in_buf, __afl_fuzz_ptr, in_buf_len);
+      LLVMFuzzerTestOneInput(in_buf, in_buf_len);
     }
   }
   Printf("%s: successfully executed %d input(s)\n", argv[0], num_runs);