aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2020-05-18 10:48:39 +0200
committervan Hauser <vh@thc.org>2020-05-18 10:48:39 +0200
commit30824bc58ef5b5f5e44fecfb3607c3ed4ad34744 (patch)
tree067ed786467fa1411c3d46dbd8478afe79be7feb
parentd1469650251b366e3d3d39e3b999bd88f4b664a8 (diff)
downloadafl++-30824bc58ef5b5f5e44fecfb3607c3ed4ad34744.tar.gz
afl-as fast system fix
-rw-r--r--src/afl-as.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/afl-as.c b/src/afl-as.c
index 4809a731..f153c043 100644
--- a/src/afl-as.c
+++ b/src/afl-as.c
@@ -233,7 +233,7 @@ static void edit_params(int argc, char **argv) {
}
modified_file =
- alloc_printf("%s/.afl-%u-%u.s", tmp_dir, (u32)getpid(), (u32)time(NULL));
+ alloc_printf("%s/.afl-%u-%u-%u.s", tmp_dir, (u32)getpid(), (u32)time(NULL), (u32)random());
wrap_things_up:
@@ -531,7 +531,7 @@ static void add_instrumentation(void) {
int main(int argc, char **argv) {
s32 pid;
- u32 rand_seed;
+ u32 rand_seed, i, j;
int status;
u8 *inst_ratio_str = getenv("AFL_INST_RATIO");
@@ -590,6 +590,10 @@ int main(int argc, char **argv) {
gettimeofday(&tv, &tz);
rand_seed = tv.tv_sec ^ tv.tv_usec ^ getpid();
+ // in fast systems where pids can repeat in the same seconds we need this
+ for (i = 1; i < argc; i++)
+ for (j = 0; j < strlen(argv[i]); j++)
+ rand_seed += argv[i][j];
srandom(rand_seed);