We check before if the AFL_PRELOAD env variable is set

This commit is contained in:
Alexandre DOYEN
2025-05-05 09:49:56 +02:00
parent 6f4767ea81
commit e9f49527e9
2 changed files with 10 additions and 2 deletions

View File

@ -1046,7 +1046,11 @@ static void __afl_start_forkserver(void) {
/* In child process: close fds, resume execution. */
if (unlikely(!child_pid)) { // just to signal afl-fuzz faster
unsetenv("AFL_FORKSERVER_PARENT");
if (unlikely(getenv("AFL_PRELOAD") != NULL)) {
unsetenv("AFL_FORKSERVER_PARENT");
}
//(void)nice(-20);

View File

@ -878,7 +878,11 @@ void afl_fsrv_start(afl_forkserver_t *fsrv, char **argv,
/* CHILD PROCESS */
setenv("AFL_FORKSERVER_PARENT", "1", 0);
if (unlikely(getenv("AFL_PRELOAD") != NULL)) {
setenv("AFL_FORKSERVER_PARENT", "1", 0);
}
// enable terminating on sigpipe in the children
struct sigaction sa;