aboutsummaryrefslogtreecommitdiff
path: root/test/test-compcov.c
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2020-04-17 19:25:34 +0200
committerGitHub <noreply@github.com>2020-04-17 19:25:34 +0200
commitddea300822e5628482366ecb38adac31717d69bc (patch)
tree113c1ba9df4b26d206a8bc0f3182222572e5f553 /test/test-compcov.c
parent504529c3aa5c80937f9f722f90d0ec55e09c6dd2 (diff)
parent9900c92ebc73a7706f4604c274ccf6430549e77e (diff)
downloadafl++-ddea300822e5628482366ecb38adac31717d69bc.tar.gz
Merge pull request #321 from AFLplusplus/dev2.64c
Push for next release
Diffstat (limited to 'test/test-compcov.c')
-rw-r--r--test/test-compcov.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/test/test-compcov.c b/test/test-compcov.c
index 89611bfb..f1743265 100644
--- a/test/test-compcov.c
+++ b/test/test-compcov.c
@@ -3,30 +3,47 @@
#include <unistd.h>
#include <string.h>
+char global_cmpval[] = "GLOBALVARIABLE";
+
int main(int argc, char **argv) {
+
char *input = argv[1], *buf, buffer[20];
+ char cmpval[] = "LOCALVARIABLE";
+ char shortval[4] = "abc";
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 if (*(unsigned int*)input == 0xabadcafe)
+
+ } else if (*(unsigned int *)input == 0xabadcafe)
+
printf("GG you eat cmp tokens for breakfast!\n");
+ else if (memcmp(cmpval, input, 8) == 0)
+ printf("local var memcmp works!\n");
+ else if (memcmp(shortval, input, 4) == 0)
+ printf("short local var memcmp works!\n");
+ else if (memcmp(global_cmpval, input, sizeof(global_cmpval)) == 0)
+ printf("global var memcmp works!\n");
else
printf("I do not know your string\n");
return 0;
}
+