about summary refs log tree commit diff
path: root/examples/defork/forking_target.c
diff options
context:
space:
mode:
authorAndrea Fioraldi <andreafioraldi@gmail.com>2020-12-08 22:43:05 +0100
committerAndrea Fioraldi <andreafioraldi@gmail.com>2020-12-08 22:43:05 +0100
commitad29eef2712f8d0b69c1acd79c6a5dfb4e2cc7f8 (patch)
treef74be06e8d1834ada6abe3daf40744e134cb9e3c /examples/defork/forking_target.c
parentc70b7ffd80ee95cdf3bf1276bfbd4a590e74d3f1 (diff)
parent6fb74342b8a3e7aa62e9e0cfe79bd84d9076a275 (diff)
downloadafl++-ad29eef2712f8d0b69c1acd79c6a5dfb4e2cc7f8.tar.gz
Merge branch 'dev' of github.com:AFLplusplus/AFLplusplus into dev
Diffstat (limited to 'examples/defork/forking_target.c')
-rw-r--r--examples/defork/forking_target.c49
1 files changed, 0 insertions, 49 deletions
diff --git a/examples/defork/forking_target.c b/examples/defork/forking_target.c
deleted file mode 100644
index 628d23c9..00000000
--- a/examples/defork/forking_target.c
+++ /dev/null
@@ -1,49 +0,0 @@
-#include <stdio.h>
-#include <unistd.h>
-#include <stdint.h>
-#include <sys/types.h>
-
-/* This is an example target for defork.c - fuzz using
-```
-mkdir in; echo a > ./in/a
-AFL_PRELOAD=./defork64.so ../../afl-fuzz -i in -o out -- ./forking_target @@
-```
-*/
-
-int main(int argc, char **argv) {
-
-  if (argc < 2) {
-
-    printf("Example tool to test defork.\nUsage ./forking_target <input>\n");
-    return -1;
-
-  }
-
-  pid_t pid = fork();
-  if (pid == 0) {
-
-    printf("We're in the child.\n");
-    FILE *f = fopen(argv[1], "r");
-    char  buf[4096];
-    fread(buf, 1, 4096, f);
-    fclose(f);
-    uint32_t offset = buf[100] + (buf[101] << 8);
-    char     test_val = buf[offset];
-    return test_val < 100;
-
-  } else if (pid < 0) {
-
-    perror("fork");
-    return -1;
-
-  } else {
-
-    printf("We are in the parent - defork didn't work! :( (pid=%d)\n",
-           (int)pid);
-
-  }
-
-  return 0;
-
-}
-