diff options
author | van Hauser <vh@thc.org> | 2020-06-17 15:05:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-17 15:05:14 +0200 |
commit | 0dc9967984df3f9c250d4c27b6de1cbd4cac3eb3 (patch) | |
tree | ca6096f1d22ba87c262bdeaf57455520ef3143e2 /src/afl-fuzz.c | |
parent | 12bdefe00e38cdc3dd8cb028eeac325ab2e94e16 (diff) | |
parent | 889e54eab858b1928f74a8c179b32275b62f2286 (diff) | |
download | afl++-0dc9967984df3f9c250d4c27b6de1cbd4cac3eb3.tar.gz |
Merge pull request #403 from AFLplusplus/dev
push to master
Diffstat (limited to 'src/afl-fuzz.c')
-rw-r--r-- | src/afl-fuzz.c | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/src/afl-fuzz.c b/src/afl-fuzz.c index d5fed9f2..cefcd73f 100644 --- a/src/afl-fuzz.c +++ b/src/afl-fuzz.c @@ -31,6 +31,21 @@ extern u64 time_spent_working; #endif +static void at_exit() { + + int i; + char *ptr = getenv("__AFL_TARGET_PID1"); + + if (ptr && *ptr && (i = atoi(ptr)) > 0) kill(i, SIGKILL); + + ptr = getenv("__AFL_TARGET_PID2"); + + if (ptr && *ptr && (i = atoi(ptr)) > 0) kill(i, SIGKILL); + + // anything else? shared memory? + +} + static u8 *get_libradamsa_path(u8 *own_loc) { u8 *tmp, *cp, *rsl, *own_copy; @@ -231,7 +246,7 @@ static int stricmp(char const *a, char const *b) { for (;; ++a, ++b) { int d; - d = tolower(*a) - tolower(*b); + d = tolower((int)*a) - tolower((int)*b); if (d != 0 || !*a) { return d; } } @@ -819,8 +834,17 @@ int main(int argc, char **argv_orig, char **envp) { } - srandom((u32)afl->init_seed); - srand((u32)afl->init_seed); // in case it is a different implementation + if (afl->init_seed) { + + afl->rand_seed[0] = afl->init_seed; + afl->rand_seed[1] = afl->init_seed ^ 0x1234567890abcdef; + afl->rand_seed[2] = afl->init_seed & 0x0123456789abcdef; + afl->rand_seed[3] = afl->init_seed | 0x01abcde43f567908; + + } + + // srandom((u32)afl->init_seed); + // srand((u32)afl->init_seed); // in case it is a different implementation if (afl->use_radamsa) { @@ -1234,6 +1258,8 @@ int main(int argc, char **argv_orig, char **envp) { } + atexit(at_exit); + perform_dry_run(afl); cull_queue(afl); |