diff options
author | vanhauser-thc <vh@thc.org> | 2020-12-09 11:30:04 +0100 |
---|---|---|
committer | vanhauser-thc <vh@thc.org> | 2020-12-09 11:30:04 +0100 |
commit | a8e568f248628c39e0bc34173470988034723627 (patch) | |
tree | b4677724560bfcd2bda784c9f4e714ff26fbf490 /utils/qbdi_mode/demo-so.c | |
parent | 39a4fac941177387578ec856aacea2187588fc13 (diff) | |
download | afl++-a8e568f248628c39e0bc34173470988034723627.tar.gz |
move libdislocator, libtokencap and qbdi_mode to utils/
Diffstat (limited to 'utils/qbdi_mode/demo-so.c')
-rwxr-xr-x | utils/qbdi_mode/demo-so.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/utils/qbdi_mode/demo-so.c b/utils/qbdi_mode/demo-so.c new file mode 100755 index 00000000..dd367036 --- /dev/null +++ b/utils/qbdi_mode/demo-so.c @@ -0,0 +1,41 @@ +#include <stdio.h> + +// gcc -shared -o libdemo.so demo-so.c -w +int target_func(char *buf, int size) { + + printf("buffer:%p, size:%p\n", buf, size); + switch (buf[0]) { + + case 1: + puts("222"); + if (buf[1] == '\x44') { + + puts("null ptr deference"); + *(char *)(0) = 1; + + } + + break; + case 0xff: + if (buf[2] == '\xff') { + + if (buf[1] == '\x44') { + + puts("crash...."); + *(char *)(0xdeadbeef) = 1; + + } + + } + + break; + default: + puts("default action"); + break; + + } + + return 1; + +} + |