about summary refs log tree commit diff
path: root/test/test-compcov.c
diff options
context:
space:
mode:
authorAndrea Fioraldi <andreafioraldi@gmail.com>2019-09-22 19:38:57 +0200
committerAndrea Fioraldi <andreafioraldi@gmail.com>2019-09-22 19:38:57 +0200
commit9aefe7a0402d4389aaff1f070c84ea1b95abc0fd (patch)
tree9e0f9f008d7a41c43a09304e8bb5364a14a8d75e /test/test-compcov.c
parent17bb51756faeaeda6fb17d63ede0a1a9d8ae4b5c (diff)
parent5044bb0332bf2bed8fe8691f411bd9c144e332af (diff)
downloadafl++-9aefe7a0402d4389aaff1f070c84ea1b95abc0fd.tar.gz
Merge branch 'master' of github.com:vanhauser-thc/AFLplusplus
Diffstat (limited to 'test/test-compcov.c')
-rw-r--r--test/test-compcov.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/test-compcov.c b/test/test-compcov.c
new file mode 100644
index 00000000..978d5551
--- /dev/null
+++ b/test/test-compcov.c
@@ -0,0 +1,30 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+int main(int argc, char** argv) {
+  char *input = argv[1], *buf, buffer[20];
+
+  if (argc < 2) {
+    ssize_t ret = read(0, buffer, sizeof(buffer) - 1);
+    buffer[ret] = 0;
+    input = buffer;
+  }
+  
+  if (strcmp(input, "LIBTOKENCAP") == 0)
+    printf("your string was libtokencap\n");
+  else if (strcmp(input, "BUGMENOT") == 0)
+    printf("your string was bugmenot\n");
+  else if (strcmp(input, "BUFFEROVERFLOW") == 0) {
+    buf = malloc(16);
+    strcpy(buf, "TEST");
+    strcat(buf, input);
+    printf("This will only crash with libdislocator: %s\n", buf);
+    return 0;
+  } else
+    printf("I do not know your string\n");
+
+  return 0;
+
+}