afl-tmin is fixed via default initialization in forkserver

This commit is contained in:
van Hauser
2020-03-10 06:44:24 +01:00
parent e04d2a6efa
commit f678731234
3 changed files with 42 additions and 70 deletions

View File

@ -135,15 +135,24 @@ void handle_timeout(int sig) {
void afl_fsrv_init(afl_forkserver_t *fsrv) {
uint32_t i, j = 0;
// this structure needs default so we initialize it if this was not done already
if (!fsrv->use_stdin) {
// this is the default and is != 0 so we need to set it if fsrv is still
// uninitialized
for (i = 0; i < sizeof(afl_forkserver_t) && j == 0; i++)
if (((char*)fsrv)[i] != 0)
j = 1;
if (j == 0)
fsrv->use_stdin = 1;
fsrv->out_fd = -1;
fsrv->out_dir_fd = -1;
fsrv->dev_null_fd = -1;
#ifndef HAVE_ARC4RANDOM
fsrv->dev_urandom_fd = -1;
#endif
fsrv->exec_tmout = EXEC_TIMEOUT;
fsrv->mem_limit = MEM_LIMIT;
fsrv->child_pid = -1;
fsrv->out_dir_fd = -1;
}
list_append(&fsrv_list, fsrv);
}